[common] disable 'check_hostname' for non-urllib3 SSLContexts

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)
pull/5580/head
Mike Fährmann 4 months ago
parent 215abbc3e4
commit 33006fe126
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -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

Loading…
Cancel
Save