Skip to content
Myr

Don't use pyOpenSSL unless no SNI is detected

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Seth Michael Larson · committed by Nate Prewitt · parent bfb93d4 · Browse files · 1 file+14 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+14 added−6 removed

  • other:+14 added−6 removed

1 file+14 added−6 removed

modified:requests/__init__.py+14 added-6 removed
88 unmodified lines
89 warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "90 "version!".format(urllib3.__version__, chardet.__version__),91 RequestsDependencyWarning)9293# Attempt to enable urllib3's SNI support, if possible93# Attempt to enable urllib3's fallback for SNI support94# if the standard library doesn't support SNI or the95# 'ssl' library isn't available.96try:95 from urllib3.contrib import pyopenssl96 pyopenssl.inject_into_urllib3()97 try:98 import ssl99 except ImportError:100 ssl = None101102 if not getattr(ssl, "HAS_SNI", False):103 from urllib3.contrib import pyopenssl104 pyopenssl.inject_into_urllib3()10598 # Check cryptography version99 from cryptography import __version__ as cryptography_version100 _check_cryptography(cryptography_version)106 # Check cryptography version107 from cryptography import __version__ as cryptography_version108 _check_cryptography(cryptography_version)109except ImportError:110 pass111112# urllib3's DependencyWarnings should be silenced.
27 unmodified lines