Delay SSL handshake

This commit is contained in:
Unrud 2018-09-04 03:33:43 +02:00
parent 17127d97a6
commit 49d35cf618

View File

@ -87,9 +87,12 @@ class ParallelHTTPServer(ParallelizationMixIn,
socket_.settimeout(self.client_timeout)
return socket_, address
def finish_request_locked(self, request, client_address):
return super().finish_request(request, client_address)
def finish_request(self, request, client_address):
with self.connections_guard:
return super().finish_request(request, client_address)
return self.finish_request_locked(request, client_address)
def handle_error(self, request, client_address):
if issubclass(sys.exc_info()[0], socket.timeout):
@ -131,6 +134,7 @@ class ParallelHTTPSServer(ParallelHTTPServer):
raise
def finish_request(self, request, client_address):
with self.connections_guard:
try:
try:
request.do_handshake()
@ -144,7 +148,7 @@ class ParallelHTTPSServer(ParallelHTTPServer):
finally:
self.shutdown_request(request)
return
return super().finish_request(request, client_address)
return super().finish_request_locked(request, client_address)
class ServerHandler(wsgiref.simple_server.ServerHandler):