mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
d5e3722c97
Many editors make it hard save a file without a terminating newline on the last line. When editing message bodies, this can cause problems. For now, I just strip the newlines off the end of the body when we return from an editor.
23 lines
724 B
Python
23 lines
724 B
Python
import socket
|
|
from SocketServer import BaseServer
|
|
from BaseHTTPServer import HTTPServer
|
|
import ssl
|
|
import handler
|
|
|
|
|
|
class SecureHTTPServer(HTTPServer):
|
|
def __init__(self, server_address, HandlerClass):
|
|
BaseServer.__init__(self, server_address, HandlerClass)
|
|
self.socket = ssl.wrap_socket(
|
|
socket.socket(self.address_family, self.socket_type),
|
|
keyfile = "data/serverkey.pem",
|
|
certfile = "data/serverkey.pem"
|
|
)
|
|
self.server_bind()
|
|
self.server_activate()
|
|
|
|
|
|
def make(port):
|
|
server_address = ('127.0.0.1', port)
|
|
return SecureHTTPServer(server_address, handler.TestRequestHandler)
|