Skip to content

Commit

Permalink
[common] disable 'check_hostname' for non-urllib3 SSLContexts
Browse files Browse the repository at this point in the history
e.g. when 'browser' is set to a non-empty value and gallery-dl creates
its own SSLContext instance instead of using requests' and urllib3's
defaults.

urllib3 disables this option for its default contexts,
since it does this check on its own.

Fixes "ValueError: Cannot set verify_mode to CERT_NONE when
check_hostname is enabled" when using --no-check-certificate.

(#3614, #4891, #5576)
  • Loading branch information
mikf committed May 10, 2024
1 parent 215abbc commit 33006fe
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions gallery_dl/extractor/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,7 @@ def _build_requests_adapter(ssl_options, ssl_ciphers, source_address):
if ssl_ciphers:
ssl_context.set_ecdh_curve("prime256v1")
ssl_context.set_ciphers(ssl_ciphers)
ssl_context.check_hostname = False
else:
ssl_context = None

Expand Down

0 comments on commit 33006fe

Please sign in to comment.