|
|
@ -44,13 +44,21 @@ _const_compare_digest = getattr(hmac, "compare_digest", _const_compare_digest_ba |
|
|
|
|
|
|
|
try: # Test for SSL features |
|
|
|
import ssl |
|
|
|
from ssl import HAS_SNI # Has SNI? |
|
|
|
from ssl import CERT_REQUIRED, wrap_socket |
|
|
|
except ImportError: |
|
|
|
pass |
|
|
|
|
|
|
|
try: |
|
|
|
from ssl import HAS_SNI # Has SNI? |
|
|
|
except ImportError: |
|
|
|
pass |
|
|
|
|
|
|
|
try: |
|
|
|
from .ssltransport import SSLTransport |
|
|
|
except ImportError: |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
try: # Platform-specific: Python 3.6 |
|
|
|
from ssl import PROTOCOL_TLS |
|
|
|
|
|
|
@ -393,7 +401,7 @@ def ssl_wrap_socket( |
|
|
|
try: |
|
|
|
if hasattr(context, "set_alpn_protocols"): |
|
|
|
context.set_alpn_protocols(ALPN_PROTOCOLS) |
|
|
|
except NotImplementedError: |
|
|
|
except NotImplementedError: # Defensive: in CI, we always have set_alpn_protocols |
|
|
|
pass |
|
|
|
|
|
|
|
# If we detect server_hostname is an IP address then the SNI |
|
|
|