mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
test: Update deprecated ssl.wrap_socket() call
ssl.wrap_socket() has been deprecated and is no longer functional in Python 3.12: https://docs.python.org/3/whatsnew/3.12.html#ssl. This patch replaces it with the equivalent (in this context) ssl.SSLContext.
This commit is contained in:
@@ -113,7 +113,11 @@ class TLSSock (Sock):
|
||||
host, port = addr.rsplit(":", 1)
|
||||
Sock.__init__(self, (host, int(port)))
|
||||
plain_sock = socket.create_connection(self.addr)
|
||||
self.sock = ssl.wrap_socket(plain_sock)
|
||||
|
||||
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
||||
context.check_hostname = False
|
||||
context.verify_mode = ssl.CERT_NONE
|
||||
self.sock = context.wrap_socket(plain_sock)
|
||||
|
||||
def connect(self):
|
||||
self.connr = self.sock.makefile(mode="r", encoding="utf8")
|
||||
|
||||
Reference in New Issue
Block a user