also update urllib3's cipher list for versions >= 1.25

This commit is contained in:
Mike Fährmann
2019-05-21 23:00:00 +02:00
parent f837ea98cb
commit 399e8e965a

View File

@@ -403,32 +403,30 @@ def generate_extractors(extractor_data, symtable, classes):
http.cookiejar.MozillaCookieJar.magic_re = re.compile( http.cookiejar.MozillaCookieJar.magic_re = re.compile(
"#( Netscape)? HTTP Cookie File", re.IGNORECASE) "#( Netscape)? HTTP Cookie File", re.IGNORECASE)
# Update default cipher list of urllib3 < 1.25 # Update default cipher list of urllib3
# to fix issues with Cloudflare and, by extension, Artstation (#227) # to fix issues with Cloudflare and, by extension, Artstation (#227)
import requests.packages.urllib3 as urllib3 # noqa from requests.packages.urllib3.util import ssl_ # noqa
if urllib3.__version__ < "1.25": logging.getLogger("gallery-dl").debug("updating default urllib3 ciphers")
from requests.packages.urllib3.util import ssl_
logging.getLogger("gallery-dl").debug( # cipher list taken from urllib3 1.25
"updating default urllib3 ciphers") # https://github.com/urllib3/urllib3/blob/1.25/src/urllib3/util/ssl_.py
# cipher list taken from urllib3 1.25 # with additions from
# https://github.com/urllib3/urllib3/blob/1.25/src/urllib3/util/ssl_.py # https://github.com/Anorov/cloudflare-scrape/pull/242
# with additions from ssl_.DEFAULT_CIPHERS = (
# https://github.com/Anorov/cloudflare-scrape/pull/242 "ECDHE+AESGCM:"
ssl_.DEFAULT_CIPHERS = ( "ECDHE+CHACHA20:"
"ECDHE+AESGCM:" "DHE+AESGCM:"
"ECDHE+CHACHA20:" "DHE+CHACHA20:"
"DHE+AESGCM:" "ECDH+AESGCM:"
"DHE+CHACHA20:" "DH+AESGCM:"
"ECDH+AESGCM:" "ECDH+AES:"
"DH+AESGCM:" "DH+AES:"
"ECDH+AES:" "RSA+AESGCM:"
"DH+AES:" "RSA+AES:"
"RSA+AESGCM:" "!ECDHE+SHA:"
"RSA+AES:" "!AES128-SHA:"
"!ECDHE+SHA:" "!aNULL:"
"!AES128-SHA:" "!eNULL:"
"!aNULL:" "!MD5:"
"!eNULL:" "!DSS"
"!MD5:" )
"!DSS"
)