[common] use 'create_urllib3_context' for creating SSLContexts

enables dumping TLS session keys by setting SSLKEYLOGFILE (#5215)
as well as other potentially useful settings.
pull/5580/head
Mike Fährmann 4 months ago
parent 33006fe126
commit 28039229fe
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -22,6 +22,7 @@ import threading
from requests.adapters import HTTPAdapter
from .message import Message
from .. import config, text, util, cache, exception
urllib3 = requests.packages.urllib3
class Extractor():
@ -834,12 +835,8 @@ def _build_requests_adapter(ssl_options, ssl_ciphers, source_address):
pass
if ssl_options or ssl_ciphers:
ssl_context = ssl.create_default_context()
if ssl_options:
ssl_context.options |= ssl_options
if ssl_ciphers:
ssl_context.set_ecdh_curve("prime256v1")
ssl_context.set_ciphers(ssl_ciphers)
ssl_context = urllib3.connection.create_urllib3_context(
options=ssl_options or None, ciphers=ssl_ciphers)
ssl_context.check_hostname = False
else:
ssl_context = None
@ -960,8 +957,6 @@ SSL_CIPHERS = {
}
urllib3 = requests.packages.urllib3
# detect brotli support
try:
BROTLI = urllib3.response.brotli is not None

Loading…
Cancel
Save