This commit is contained in:
j 2017-05-30 12:51:21 +02:00
parent f811d74b5e
commit 3ecd742bd8

View file

@ -54,7 +54,7 @@ class TLSTCPServer(socketserver.TCPServer):
def __init__(self, server_address, HandlerClass, bind_and_activate=True): def __init__(self, server_address, HandlerClass, bind_and_activate=True):
socketserver.TCPServer.__init__(self, server_address, HandlerClass) socketserver.TCPServer.__init__(self, server_address, HandlerClass)
ctx = Context(TLSv1_2_METHOD) ctx = Context(TLSv1_2_METHOD)
ctx.use_privatekey_file (settings.ssl_key_path) ctx.use_privatekey_file(settings.ssl_key_path)
ctx.use_certificate_file(settings.ssl_cert_path) ctx.use_certificate_file(settings.ssl_cert_path)
# only allow clients with cert: # only allow clients with cert:
ctx.set_verify(VERIFY_PEER | VERIFY_CLIENT_ONCE | VERIFY_FAIL_IF_NO_PEER_CERT, self._accept) ctx.set_verify(VERIFY_PEER | VERIFY_CLIENT_ONCE | VERIFY_FAIL_IF_NO_PEER_CERT, self._accept)
@ -64,7 +64,7 @@ class TLSTCPServer(socketserver.TCPServer):
self.server_bind() self.server_bind()
self.server_activate() self.server_activate()
def shutdown_request(self,request): def shutdown_request(self, request):
try: try:
request.shutdown() request.shutdown()
except: except:
@ -109,7 +109,7 @@ class Handler(http.server.SimpleHTTPRequestHandler):
def log_message(self, format, *args): def log_message(self, format, *args):
if settings.DEBUG_HTTP: if settings.DEBUG_HTTP:
logger.debug("%s - - [%s] %s\n", self.address_string(), logger.debug("%s - - [%s] %s\n", self.address_string(),
self.log_date_time_string(), format%args) self.log_date_time_string(), format % args)
def do_HEAD(self): def do_HEAD(self):
return self.do_GET() return self.do_GET()