Skip to content

Commit 9b3b887

Browse files
Update runsslserver for modern python
Merged PR teddziuba#110 from the original
1 parent 27c6f46 commit 9b3b887

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

sslserver/management/commands/runsslserver.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@ class ThreadedWSGIServer(socketserver.ThreadingMixIn, WSGIServer):
4848
class SecureHTTPServer(ThreadedWSGIServer):
4949
def __init__(self, address, handler_cls, certificate, key, ipv6=False):
5050
super(SecureHTTPServer, self).__init__(address, handler_cls, ipv6=ipv6)
51-
self.socket = ssl.wrap_socket(self.socket, certfile=certificate,
52-
keyfile=key, server_side=True,
53-
ssl_version=_ssl_version,
54-
cert_reqs=ssl.CERT_NONE)
55-
51+
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
52+
context.load_cert_chain(certfile=certificate, keyfile=key)
53+
self.socket = context.wrap_socket(self.socket, server_side=True)
5654

5755
class WSGIRequestHandler(WSGIRequestHandler):
5856
def get_environ(self):

0 commit comments

Comments
 (0)