diff --git a/test/test_http_proxy.py b/test/test_http_proxy.py index a39c7651f..4ebdf0148 100644 --- a/test/test_http_proxy.py +++ b/test/test_http_proxy.py @@ -154,7 +154,7 @@ def __init__(self, *args, proxy_info=None, **kwargs): def handle(self): import websockets.sync.server protocol = websockets.ServerProtocol() - connection = websockets.sync.server.ServerConnection(socket=self.request, protocol=protocol, close_timeout=0) + connection = websockets.sync.server.ServerConnection(socket=self.request, protocol=protocol, close_timeout=2) connection.handshake() for message in connection: if message == 'proxy_info': diff --git a/yt_dlp/networking/_websockets.py b/yt_dlp/networking/_websockets.py index 46b6c7ccd..d808213da 100644 --- a/yt_dlp/networking/_websockets.py +++ b/yt_dlp/networking/_websockets.py @@ -265,6 +265,6 @@ def __init__(self, ssl_context: ssl.SSLContext): self.ssl_context = ssl_context def wrap_socket(self, sock, server_hostname=None): - if isinstance(sock, ssl.SSLSocket) or WebsocketsSSLTransport: + if WebsocketsSSLTransport: return WebsocketsSSLTransport(sock, self.ssl_context, server_hostname=server_hostname) return self.ssl_context.wrap_socket(sock, server_hostname=server_hostname)