From 723c47d352f4dc7c1c30e0c91937c193218e29f2 Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Thu, 31 Oct 2024 13:09:52 +0000 Subject: [PATCH] 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. --- test/util/chamuyero | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/util/chamuyero b/test/util/chamuyero index fa74b8a..24d49f6 100755 --- a/test/util/chamuyero +++ b/test/util/chamuyero @@ -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")