diff options
author | panni <[email protected]> | 2019-04-28 06:02:12 +0200 |
---|---|---|
committer | panni <[email protected]> | 2019-04-28 06:02:12 +0200 |
commit | 87165e91f27336d93f98b2e79a1dd82199b69548 (patch) | |
tree | ebfab3ca30a86139bb4269310930510d0af58c28 /libs/urllib3 | |
parent | 07c37b82542a96c5e7917f361751d6d297e817f2 (diff) | |
download | bazarr-87165e91f27336d93f98b2e79a1dd82199b69548.tar.gz bazarr-87165e91f27336d93f98b2e79a1dd82199b69548.zip |
core: update to subliminal_patch:head
Diffstat (limited to 'libs/urllib3')
-rw-r--r-- | libs/urllib3/__init__.py | 2 | ||||
-rw-r--r-- | libs/urllib3/contrib/pyopenssl.py | 3 | ||||
-rw-r--r-- | libs/urllib3/poolmanager.py | 7 | ||||
-rw-r--r-- | libs/urllib3/response.py | 8 | ||||
-rw-r--r-- | libs/urllib3/util/retry.py | 3 | ||||
-rw-r--r-- | libs/urllib3/util/ssl_.py | 7 |
6 files changed, 21 insertions, 9 deletions
diff --git a/libs/urllib3/__init__.py b/libs/urllib3/__init__.py index 75725167e..61915465f 100644 --- a/libs/urllib3/__init__.py +++ b/libs/urllib3/__init__.py @@ -27,7 +27,7 @@ from logging import NullHandler __author__ = 'Andrey Petrov ([email protected])' __license__ = 'MIT' -__version__ = '1.24' +__version__ = '1.24.2' __all__ = ( 'HTTPConnectionPool', diff --git a/libs/urllib3/contrib/pyopenssl.py b/libs/urllib3/contrib/pyopenssl.py index 7c0e9465d..5ab7803ac 100644 --- a/libs/urllib3/contrib/pyopenssl.py +++ b/libs/urllib3/contrib/pyopenssl.py @@ -184,6 +184,9 @@ def _dnsname_to_stdlib(name): except idna.core.IDNAError: return None + if ':' in name: + return name + name = idna_encode(name) if name is None: return None diff --git a/libs/urllib3/poolmanager.py b/libs/urllib3/poolmanager.py index fe5491cfd..32bd97302 100644 --- a/libs/urllib3/poolmanager.py +++ b/libs/urllib3/poolmanager.py @@ -7,6 +7,7 @@ from ._collections import RecentlyUsedContainer from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool from .connectionpool import port_by_scheme from .exceptions import LocationValueError, MaxRetryError, ProxySchemeUnknown +from .packages import six from .packages.six.moves.urllib.parse import urljoin from .request import RequestMethods from .util.url import parse_url @@ -342,8 +343,10 @@ class PoolManager(RequestMethods): # conn.is_same_host() which may use socket.gethostbyname() in the future. if (retries.remove_headers_on_redirect and not conn.is_same_host(redirect_location)): - for header in retries.remove_headers_on_redirect: - kw['headers'].pop(header, None) + headers = list(six.iterkeys(kw['headers'])) + for header in headers: + if header.lower() in retries.remove_headers_on_redirect: + kw['headers'].pop(header, None) try: retries = retries.increment(method, url, response=response, _pool=conn) diff --git a/libs/urllib3/response.py b/libs/urllib3/response.py index f0cfbb549..c112690b0 100644 --- a/libs/urllib3/response.py +++ b/libs/urllib3/response.py @@ -69,9 +69,9 @@ class GzipDecoder(object): return getattr(self._obj, name) def decompress(self, data): - ret = b'' + ret = bytearray() if self._state == GzipDecoderState.SWALLOW_DATA or not data: - return ret + return bytes(ret) while True: try: ret += self._obj.decompress(data) @@ -81,11 +81,11 @@ class GzipDecoder(object): self._state = GzipDecoderState.SWALLOW_DATA if previous_state == GzipDecoderState.OTHER_MEMBERS: # Allow trailing garbage acceptable in other gzip clients - return ret + return bytes(ret) raise data = self._obj.unused_data if not data: - return ret + return bytes(ret) self._state = GzipDecoderState.OTHER_MEMBERS self._obj = zlib.decompressobj(16 + zlib.MAX_WBITS) diff --git a/libs/urllib3/util/retry.py b/libs/urllib3/util/retry.py index e7d0abd61..02429ee8e 100644 --- a/libs/urllib3/util/retry.py +++ b/libs/urllib3/util/retry.py @@ -179,7 +179,8 @@ class Retry(object): self.raise_on_status = raise_on_status self.history = history or tuple() self.respect_retry_after_header = respect_retry_after_header - self.remove_headers_on_redirect = remove_headers_on_redirect + self.remove_headers_on_redirect = frozenset([ + h.lower() for h in remove_headers_on_redirect]) def new(self, **kw): params = dict( diff --git a/libs/urllib3/util/ssl_.py b/libs/urllib3/util/ssl_.py index 24ee26d63..5ae435827 100644 --- a/libs/urllib3/util/ssl_.py +++ b/libs/urllib3/util/ssl_.py @@ -263,6 +263,8 @@ def create_urllib3_context(ssl_version=None, cert_reqs=None, """ context = SSLContext(ssl_version or ssl.PROTOCOL_SSLv23) + context.set_ciphers(ciphers or DEFAULT_CIPHERS) + # Setting the default here, as we may have no ssl module on import cert_reqs = ssl.CERT_REQUIRED if cert_reqs is None else cert_reqs @@ -325,7 +327,10 @@ def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None, if e.errno == errno.ENOENT: raise SSLError(e) raise - elif getattr(context, 'load_default_certs', None) is not None: + + # Don't load system certs unless there were no CA certs or + # SSLContext object specified manually. + elif ssl_context is None and hasattr(context, 'load_default_certs'): # try to load OS default certs; works well on Windows (require Python3.4+) context.load_default_certs() |