Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[script.module.urllib3@krypton] 1.26.20 #2692

Open
wants to merge 1 commit into
base: krypton
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion script.module.urllib3/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.module.urllib3" name="urllib3" version="1.26.18" provider-name="urllib3">
<addon id="script.module.urllib3" name="urllib3" version="1.26.20" provider-name="urllib3">
<requires>
<import addon="xbmc.python" version="2.25.0" />
</requires>
Expand Down
2 changes: 1 addition & 1 deletion script.module.urllib3/lib/urllib3/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# This file is protected via CODEOWNERS
__version__ = "1.26.18"
__version__ = "1.26.20"
4 changes: 2 additions & 2 deletions script.module.urllib3/lib/urllib3/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class BrokenPipeError(Exception):

# When it comes time to update this value as a part of regular maintenance
# (ie test_recent_date is failing) update it to ~6 months before the current date.
RECENT_DATE = datetime.date(2022, 1, 1)
RECENT_DATE = datetime.date(2024, 1, 1)

_CONTAINS_CONTROL_CHAR_RE = re.compile(r"[^-!#$%&'*+.^_`|~0-9a-zA-Z]")

Expand Down Expand Up @@ -437,7 +437,7 @@ def connect(self):
and self.ssl_version is None
and hasattr(self.sock, "version")
and self.sock.version() in {"TLSv1", "TLSv1.1"}
):
): # Defensive:
warnings.warn(
"Negotiating TLSv1/TLSv1.1 by default is deprecated "
"and will be disabled in urllib3 v2.0.0. Connecting to "
Expand Down
7 changes: 5 additions & 2 deletions script.module.urllib3/lib/urllib3/connectionpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,13 @@ def _make_request(
pass
except IOError as e:
# Python 2 and macOS/Linux
# EPIPE and ESHUTDOWN are BrokenPipeError on Python 2, and EPROTOTYPE is needed on macOS
# EPIPE and ESHUTDOWN are BrokenPipeError on Python 2, and EPROTOTYPE/ECONNRESET are needed on macOS
# https://erickt.github.io/blog/2014/11/19/adventures-in-debugging-a-potential-osx-kernel-bug/
if e.errno not in {
errno.EPIPE,
errno.ESHUTDOWN,
errno.EPROTOTYPE,
errno.ECONNRESET,
}:
raise

Expand Down Expand Up @@ -768,7 +769,9 @@ def _is_ssl_error_message_from_http_proxy(ssl_error):
# so we try to cover our bases here!
message = " ".join(re.split("[^a-z]", str(ssl_error).lower()))
return (
"wrong version number" in message or "unknown protocol" in message
"wrong version number" in message
or "unknown protocol" in message
or "record layer failure" in message
)

# Try to detect a common user error with proxies which is to
Expand Down
4 changes: 3 additions & 1 deletion script.module.urllib3/lib/urllib3/util/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ class Retry(object):
RETRY_AFTER_STATUS_CODES = frozenset([413, 429, 503])

#: Default headers to be used for ``remove_headers_on_redirect``
DEFAULT_REMOVE_HEADERS_ON_REDIRECT = frozenset(["Cookie", "Authorization"])
DEFAULT_REMOVE_HEADERS_ON_REDIRECT = frozenset(
["Cookie", "Authorization", "Proxy-Authorization"]
)

#: Maximum backoff time.
DEFAULT_BACKOFF_MAX = 120
Expand Down
17 changes: 13 additions & 4 deletions script.module.urllib3/lib/urllib3/util/ssl_.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from __future__ import absolute_import

import hashlib
import hmac
import os
import sys
import warnings
from binascii import hexlify, unhexlify
from hashlib import md5, sha1, sha256

from ..exceptions import (
InsecurePlatformWarning,
Expand All @@ -24,7 +24,10 @@
ALPN_PROTOCOLS = ["http/1.1"]

# Maps the length of a digest to a possible hash function producing this digest
HASHFUNC_MAP = {32: md5, 40: sha1, 64: sha256}
HASHFUNC_MAP = {
length: getattr(hashlib, algorithm, None)
for length, algorithm in ((32, "md5"), (40, "sha1"), (64, "sha256"))
}


def _const_compare_digest_backport(a, b):
Expand Down Expand Up @@ -191,9 +194,15 @@ def assert_fingerprint(cert, fingerprint):

fingerprint = fingerprint.replace(":", "").lower()
digest_length = len(fingerprint)
hashfunc = HASHFUNC_MAP.get(digest_length)
if not hashfunc:
if digest_length not in HASHFUNC_MAP:
raise SSLError("Fingerprint of invalid length: {0}".format(fingerprint))
hashfunc = HASHFUNC_MAP.get(digest_length)
if hashfunc is None:
raise SSLError(
"Hash function implementation unavailable for fingerprint length: {0}".format(
digest_length
)
)

# We need encode() here for py32; works on py2 and p33.
fingerprint_bytes = unhexlify(fingerprint.encode())
Expand Down
Loading