minor fix

This commit is contained in:
coletdjnz 2024-05-18 17:28:25 +12:00
parent d274eb1f53
commit 4cfce3b22f
No known key found for this signature in database
GPG Key ID: 91984263BB39894A

View File

@ -201,9 +201,7 @@ def _send(self, request):
ssl_context = None
sock = self._make_sock(proxy, request.url, timeout)
if parse_uri(request.url).secure:
ssl_context = self._make_sslcontext()
if isinstance(sock, ssl.SSLSocket) and WebsocketsSSLContext: # tls in tls
ssl_context = WebsocketsSSLContext(ssl_context)
ssl_context = WebsocketsSSLContext(self._make_sslcontext())
try:
conn = websockets.sync.client.connect(
@ -272,6 +270,6 @@ def __init__(self, ssl_context: ssl.SSLContext):
self.ssl_context = ssl_context
def wrap_socket(self, sock, server_hostname=None):
if WebsocketsSSLTransport:
if isinstance(sock, ssl.SSLSocket) and WebsocketsSSLTransport:
return WebsocketsSSLTransport(sock, self.ssl_context, server_hostname=server_hostname)
return self.ssl_context.wrap_socket(sock, server_hostname=server_hostname)