Skip to content

Commit a26b0ff

Browse files
authored
Merge pull request #12944 from illia-v/urllib3-1.26.20
2 parents b989e6e + 8dd3988 commit a26b0ff

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

news/urllib3.vendor.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Upgrade urllib3 to 1.26.19
1+
Upgrade urllib3 to 1.26.20

src/pip/_vendor/urllib3/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# This file is protected via CODEOWNERS
2-
__version__ = "1.26.19"
2+
__version__ = "1.26.20"

src/pip/_vendor/urllib3/connectionpool.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,12 +423,13 @@ def _make_request(
423423
pass
424424
except IOError as e:
425425
# Python 2 and macOS/Linux
426-
# EPIPE and ESHUTDOWN are BrokenPipeError on Python 2, and EPROTOTYPE is needed on macOS
426+
# EPIPE and ESHUTDOWN are BrokenPipeError on Python 2, and EPROTOTYPE/ECONNRESET are needed on macOS
427427
# https://erickt.github.io/blog/2014/11/19/adventures-in-debugging-a-potential-osx-kernel-bug/
428428
if e.errno not in {
429429
errno.EPIPE,
430430
errno.ESHUTDOWN,
431431
errno.EPROTOTYPE,
432+
errno.ECONNRESET,
432433
}:
433434
raise
434435

src/pip/_vendor/urllib3/util/ssl_.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from __future__ import absolute_import
22

3+
import hashlib
34
import hmac
45
import os
56
import sys
67
import warnings
78
from binascii import hexlify, unhexlify
8-
from hashlib import md5, sha1, sha256
99

1010
from ..exceptions import (
1111
InsecurePlatformWarning,
@@ -24,7 +24,10 @@
2424
ALPN_PROTOCOLS = ["http/1.1"]
2525

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

2932

3033
def _const_compare_digest_backport(a, b):
@@ -191,9 +194,15 @@ def assert_fingerprint(cert, fingerprint):
191194

192195
fingerprint = fingerprint.replace(":", "").lower()
193196
digest_length = len(fingerprint)
194-
hashfunc = HASHFUNC_MAP.get(digest_length)
195-
if not hashfunc:
197+
if digest_length not in HASHFUNC_MAP:
196198
raise SSLError("Fingerprint of invalid length: {0}".format(fingerprint))
199+
hashfunc = HASHFUNC_MAP.get(digest_length)
200+
if hashfunc is None:
201+
raise SSLError(
202+
"Hash function implementation unavailable for fingerprint length: {0}".format(
203+
digest_length
204+
)
205+
)
197206

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

src/pip/_vendor/vendor.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pyproject-hooks==1.0.0
88
requests==2.32.3
99
certifi==2024.7.4
1010
idna==3.7
11-
urllib3==1.26.19
11+
urllib3==1.26.20
1212
rich==13.7.1
1313
pygments==2.18.0
1414
typing_extensions==4.12.2

0 commit comments

Comments
 (0)