Эх сурвалжийг харах

[desktop] requests should only set tls hostname if supported

The ssl SNI allows a request to set the expected hostname
as part of the SSL handshake, but SUSE11 doesn't support this
mechanism. As a workaround, this patch checks if the method
`set_tlsext_host_name` was enabled, and only uses it if it
was compiled into PyOpenSSL.
Erick Tryzelaar 9 жил өмнө
parent
commit
70e5fd3f76

+ 3 - 1
desktop/core/ext-py/requests-2.6.0/requests/packages/urllib3/contrib/pyopenssl.py

@@ -293,7 +293,9 @@ def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None,
     ctx.set_cipher_list(DEFAULT_SSL_CIPHER_LIST)
 
     cnx = OpenSSL.SSL.Connection(ctx, sock)
-    cnx.set_tlsext_host_name(server_hostname)
+    # Hue Patch: Only set the SNI hostname if PyOpenSSL supports it.
+    if hasattr(cnx, 'set_tlsext_host_name'):
+        cnx.set_tlsext_host_name(server_hostname)
     cnx.set_connect_state()
     while True:
         try: