Replace deprecated ssl.wrap_socket method

This commit is contained in:
Chris Smowton
2024-05-14 15:14:27 +01:00
parent 10e1bfcee5
commit 8814e6e2bd

View File

@@ -4,8 +4,9 @@ import ssl
httpd = HTTPServer(('localhost', 4443), SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket (httpd.socket,
keyfile="../key.pem",
certfile="../cert.pem", server_side=True)
sslctx = ssl.SSLContext()
sslctx.load_cert_chain(certfile="../cert.pem", keyfile="../key.pem")
httpd.socket = sslctx.wrap_socket (httpd.socket, server_side=True)
httpd.serve_forever()