Python 3.12: do not use ssl.wrap_socket

The ssl.wrap_socket method has been removed in 3.12.
SSLContext.wrap_socket should now be used.

Change-Id: Ic5acb1028ae702150b02f53c08e1b209ddf04dd8
This commit is contained in:
Cyril Roelandt 2024-07-03 21:44:35 +02:00
parent bb08bb4605
commit 15b685886c

View File

@ -105,9 +105,9 @@ def main():
RequestHandler)
if args.ssl_certificate and args.ssl_key:
httpd.socket = ssl.wrap_socket(
httpd.socket, keyfile=args.ssl_key,
certfile=args.ssl_certificate, server_side=True)
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain(args.ssl_certificate, args.ssl_key)
httpd.socket = context.wrap_socket(httpd.socket, server_side=True)
httpd.serve_forever()