Skip to content

Commit

Permalink
[common] use 'create_urllib3_context' for creating SSLContexts
Browse files Browse the repository at this point in the history
enables dumping TLS session keys by setting SSLKEYLOGFILE (#5215)
as well as other potentially useful settings.
  • Loading branch information
mikf committed May 10, 2024
1 parent 33006fe commit 2803922
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions gallery_dl/extractor/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from requests.adapters import HTTPAdapter
from .message import Message
from .. import config, text, util, cache, exception
urllib3 = requests.packages.urllib3


class Extractor():
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -960,8 +957,6 @@ def _browser_useragent():
}


urllib3 = requests.packages.urllib3

# detect brotli support
try:
BROTLI = urllib3.response.brotli is not None
Expand Down

0 comments on commit 2803922

Please sign in to comment.