Python3.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: Ided77a9c9b8e409105de18abf195405927a3684f
This commit is contained in:
parent
59331d56eb
commit
fa495fe34c
@ -45,12 +45,11 @@ class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
|
|||||||
cert_file = os.path.join(TEST_VAR_DIR, 'certificate.crt')
|
cert_file = os.path.join(TEST_VAR_DIR, 'certificate.crt')
|
||||||
cacert = os.path.join(TEST_VAR_DIR, 'ca.crt')
|
cacert = os.path.join(TEST_VAR_DIR, 'ca.crt')
|
||||||
(_sock, addr) = socketserver.TCPServer.get_request(self)
|
(_sock, addr) = socketserver.TCPServer.get_request(self)
|
||||||
sock = ssl.wrap_socket(_sock,
|
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
|
||||||
certfile=cert_file,
|
context.verify_mode = ssl.CERT_REQUIRED
|
||||||
keyfile=key_file,
|
context.load_verify_locations(cacert)
|
||||||
ca_certs=cacert,
|
context.load_cert_chain(cert_file, key_file)
|
||||||
server_side=True,
|
sock = context.wrap_socket(_sock, server_side=True)
|
||||||
cert_reqs=ssl.CERT_REQUIRED)
|
|
||||||
return sock, addr
|
return sock, addr
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user