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/requests | |
parent | 07c37b82542a96c5e7917f361751d6d297e817f2 (diff) | |
download | bazarr-87165e91f27336d93f98b2e79a1dd82199b69548.tar.gz bazarr-87165e91f27336d93f98b2e79a1dd82199b69548.zip |
core: update to subliminal_patch:head
Diffstat (limited to 'libs/requests')
-rw-r--r-- | libs/requests/__version__.py | 4 | ||||
-rw-r--r-- | libs/requests/models.py | 2 | ||||
-rw-r--r-- | libs/requests/sessions.py | 13 | ||||
-rw-r--r-- | libs/requests/utils.py | 4 |
4 files changed, 17 insertions, 6 deletions
diff --git a/libs/requests/__version__.py b/libs/requests/__version__.py index be8a45fe0..f5b5d0367 100644 --- a/libs/requests/__version__.py +++ b/libs/requests/__version__.py @@ -5,8 +5,8 @@ __title__ = 'requests' __description__ = 'Python HTTP for Humans.' __url__ = 'http://python-requests.org' -__version__ = '2.20.0' -__build__ = 0x022000 +__version__ = '2.21.0' +__build__ = 0x022100 __author__ = 'Kenneth Reitz' __author_email__ = '[email protected]' __license__ = 'Apache 2.0' diff --git a/libs/requests/models.py b/libs/requests/models.py index 3dded57ef..62dcd0b7c 100644 --- a/libs/requests/models.py +++ b/libs/requests/models.py @@ -781,7 +781,7 @@ class Response(object): return chunks - def iter_lines(self, chunk_size=ITER_CHUNK_SIZE, decode_unicode=None, delimiter=None): + def iter_lines(self, chunk_size=ITER_CHUNK_SIZE, decode_unicode=False, delimiter=None): """Iterates over the response data, one line at a time. When stream=True is set on the request, this avoids reading the content at once into memory for large responses. diff --git a/libs/requests/sessions.py b/libs/requests/sessions.py index a448bd83f..d73d700fa 100644 --- a/libs/requests/sessions.py +++ b/libs/requests/sessions.py @@ -19,7 +19,7 @@ from .cookies import ( from .models import Request, PreparedRequest, DEFAULT_REDIRECT_LIMIT from .hooks import default_hooks, dispatch_hook from ._internal_utils import to_native_string -from .utils import to_key_val_list, default_headers +from .utils import to_key_val_list, default_headers, DEFAULT_PORTS from .exceptions import ( TooManyRedirects, InvalidSchema, ChunkedEncodingError, ContentDecodingError) @@ -128,8 +128,17 @@ class SessionRedirectMixin(object): if (old_parsed.scheme == 'http' and old_parsed.port in (80, None) and new_parsed.scheme == 'https' and new_parsed.port in (443, None)): return False + + # Handle default port usage corresponding to scheme. + changed_port = old_parsed.port != new_parsed.port + changed_scheme = old_parsed.scheme != new_parsed.scheme + default_port = (DEFAULT_PORTS.get(old_parsed.scheme, None), None) + if (not changed_scheme and old_parsed.port in default_port + and new_parsed.port in default_port): + return False + # Standard case: root URI must match - return old_parsed.port != new_parsed.port or old_parsed.scheme != new_parsed.scheme + return changed_port or changed_scheme def resolve_redirects(self, resp, req, stream=False, timeout=None, verify=True, cert=None, proxies=None, yield_requests=False, **adapter_kwargs): diff --git a/libs/requests/utils.py b/libs/requests/utils.py index 0ce7fe115..8170a8d2c 100644 --- a/libs/requests/utils.py +++ b/libs/requests/utils.py @@ -38,6 +38,8 @@ NETRC_FILES = ('.netrc', '_netrc') DEFAULT_CA_BUNDLE_PATH = certs.where() +DEFAULT_PORTS = {'http': 80, 'https': 443} + if sys.platform == 'win32': # provide a proxy_bypass version on Windows without DNS lookups @@ -264,7 +266,7 @@ def from_key_val_list(value): >>> from_key_val_list([('key', 'val')]) OrderedDict([('key', 'val')]) >>> from_key_val_list('string') - ValueError: need more than 1 value to unpack + ValueError: cannot encode objects that are not 2-tuples >>> from_key_val_list({'key': 'val'}) OrderedDict([('key', 'val')]) |