!76 update to urllib3-1.26.16

From: @chengyechun 
Reviewed-by: @kircher 
Signed-off-by: @kircher
This commit is contained in:
openeuler-ci-bot 2023-08-01 08:25:37 +00:00 committed by Gitee
commit 26d287ff04
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
9 changed files with 8 additions and 265 deletions

Binary file not shown.

BIN
1.26.16.tar.gz Normal file

Binary file not shown.

View File

@ -1,29 +0,0 @@
From a06c05cd4bba292ee26e3e9116cff902e0440b52 Mon Sep 17 00:00:00 2001
From: Ben Kallus <49924171+kenballus@users.noreply.github.com>
Date: Wed, 8 Feb 2023 15:19:07 +0000
Subject: [PATCH] Fix _idna_encode handling of '\x80'
Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
Conflict:1.The content of "@@" is adapted 2.The line number is adapted
Reference:https://github.com/urllib3/urllib3/commit/a06c05cd4bba292ee26e3e9116cff902e0440b52
---
src/urllib3/util/url.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/urllib3/util/url.py b/src/urllib3/util/url.py
index 63166e8..8bac93a 100644
--- a/src/urllib3/util/url.py
+++ b/src/urllib3/util/url.py
@@ -300,7 +300,7 @@ def _normalize_host(host, scheme):
def _idna_encode(name):
- if name and any([ord(x) > 128 for x in name]):
+ if name and any(ord(x) >= 128 for x in name):
try:
import idna
except ImportError:
--
2.27.0

View File

@ -1,75 +0,0 @@
From a7ce8e0881c94800b14687145ee11940246d2b22 Mon Sep 17 00:00:00 2001
From: Nick Williams <68963309+nickwilliams-zaxiom@users.noreply.github.com>
Date: Fri, 20 Jan 2023 07:59:33 -0600
Subject: [PATCH] [1.26] Fix socket timeout value when HTTPConnection is reused
Co-authored-by: Seth Michael Larson <sethmichaellarson@gmail.com>
Co-authored-by: Quentin Pradet <quentin.pradet@gmail.com>
Conflict:1.The content of "@@" is adapted 2.The line number is adapted 3. no add testcode
Reference:https://github.com/urllib3/urllib3/commit/a7ce8e0881c94800b14687145ee11940246d2b22
---
src/urllib3/connection.py | 5 +++++
src/urllib3/connectionpool.py | 2 +-
src/urllib3/util/timeout.py | 9 ++++++---
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/urllib3/connection.py b/src/urllib3/connection.py
index f48daea..f121511 100644
--- a/src/urllib3/connection.py
+++ b/src/urllib3/connection.py
@@ -229,6 +229,11 @@ class HTTPConnection(_HTTPConnection, object):
)
def request(self, method, url, body=None, headers=None):
+ # Update the inner socket's timeout value to send the request.
+ # This only triggers if the connection is re-used.
+ if getattr(self, "sock", None) is not None:
+ self.sock.settimeout(self.timeout)
+
if headers is None:
headers = {}
else:
diff --git a/src/urllib3/connectionpool.py b/src/urllib3/connectionpool.py
index 8dccf4b..e528019 100644
--- a/src/urllib3/connectionpool.py
+++ b/src/urllib3/connectionpool.py
@@ -375,7 +375,7 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
timeout_obj = self._get_timeout(timeout)
timeout_obj.start_connect()
- conn.timeout = timeout_obj.connect_timeout
+ conn.timeout = Timeout.resolve_default_timeout(timeout_obj.connect_timeout)
# Trigger any extra validation we need to do.
try:
diff --git a/src/urllib3/util/timeout.py b/src/urllib3/util/timeout.py
index ff69593..78e18a6 100644
--- a/src/urllib3/util/timeout.py
+++ b/src/urllib3/util/timeout.py
@@ -2,9 +2,8 @@ from __future__ import absolute_import
import time
-# The default socket timeout, used by httplib to indicate that no timeout was
-# specified by the user
-from socket import _GLOBAL_DEFAULT_TIMEOUT
+# The default socket timeout, used by httplib to indicate that no timeout was; specified by the user
+from socket import _GLOBAL_DEFAULT_TIMEOUT, getdefaulttimeout
from ..exceptions import TimeoutStateError
@@ -116,6 +115,10 @@ class Timeout(object):
# __str__ provided for backwards compatibility
__str__ = __repr__
+ @classmethod
+ def resolve_default_timeout(cls, timeout):
+ return getdefaulttimeout() if timeout is cls.DEFAULT_TIMEOUT else timeout
+
@classmethod
def _validate_timeout(cls, value, name):
"""Check that a timeout attribute is valid.
--
2.27.0

View File

@ -1,27 +0,0 @@
From 27370204dbcb2ee555a136948afee276a96ddc87 Mon Sep 17 00:00:00 2001
From: Ben Kallus <49924171+kenballus@users.noreply.github.com>
Date: Fri, 3 Feb 2023 08:38:04 -0500
Subject: [PATCH] [1.26] Remove "!" character from the "unreserved" characters
in IPv6 Zone ID parsing
Conflict:The content of "index" and "@@" are adapted
Reference:https://github.com/urllib3/urllib3/commit/27370204dbcb2ee555a136948afee276a96ddc87
---
src/urllib3/util/url.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/urllib3/util/url.py b/src/urllib3/util/url.py
index 63166e8..33dfb45 100644
--- a/src/urllib3/util/url.py
+++ b/src/urllib3/util/url.py
@@ -50,7 +50,7 @@ _variations = [
"(?:(?:%(hex)s:){0,6}%(hex)s)?::",
]
-UNRESERVED_PAT = r"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._!\-~"
+UNRESERVED_PAT = r"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._\-~"
IPV6_PAT = "(?:" + "|".join([x % _subs for x in _variations]) + ")"
ZONE_ID_PAT = "(?:%25|%)(?:[" + UNRESERVED_PAT + "]|%[a-fA-F0-9]{2})+"
IPV6_ADDRZ_PAT = r"\[" + IPV6_PAT + r"(?:" + ZONE_ID_PAT + r")?\]"
--
2.27.0

View File

@ -1,33 +0,0 @@
From 25cca389496b86ee809c21e5b641aeaa74809263 Mon Sep 17 00:00:00 2001
From: Seth Michael Larson <sethmichaellarson@gmail.com>
Date: Tue, 25 Apr 2023 02:10:00 AM GMT+0800
Subject: [PATCH] fix test_ssl_object_attributes
Conflict:NA
Reference:https://github.com/urllib3/urllib3/commit/25cca389496b86ee809c21e5b641aeaa74809263
---
test/test_ssltransport.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/test/test_ssltransport.py b/test/test_ssltransport.py
index e8d779f..809e053 100644
--- a/test/test_ssltransport.py
+++ b/test/test_ssltransport.py
@@ -205,8 +205,11 @@ class SingleTLSLayerTestCase(SocketDummyServerTestCase):
assert ssock.selected_npn_protocol() is None
shared_ciphers = ssock.shared_ciphers()
- assert type(shared_ciphers) == list
- assert len(shared_ciphers) > 0
+ # SSLContext.shared_ciphers() changed behavior completely in a patch version.
+ # See: https://github.com/python/cpython/issues/96931
+ assert shared_ciphers is None or (
+ type(shared_ciphers) is list and len(shared_ciphers) > 0
+ )
assert ssock.compression() is None
--
2.23.0

View File

@ -1,48 +0,0 @@
From 25fbd5fb72ae8790cff9512878d302120e387e64 Mon Sep 17 00:00:00 2001
From: Anil Khatri <anilkhatri.dev@gmail.com>
Date: Sat, 31 Dec 2022 01:38:50 +0530
Subject: [PATCH] Fixed issue with port "0" returning None
Conflict:adapt:
1.The content of "@@" is adapted
2.The line number is adapted
Reference:https://github.com/urllib3/urllib3/pull/2864
---
src/urllib3/util/url.py | 2 +-
test/test_util.py | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/urllib3/util/url.py b/src/urllib3/util/url.py
index 8964cef..63166e8 100644
--- a/src/urllib3/util/url.py
+++ b/src/urllib3/util/url.py
@@ -63,7 +63,7 @@ IPV6_ADDRZ_RE = re.compile("^" + IPV6_ADDRZ_PAT + "$")
BRACELESS_IPV6_ADDRZ_RE = re.compile("^" + IPV6_ADDRZ_PAT[2:-2] + "$")
ZONE_ID_RE = re.compile("(" + ZONE_ID_PAT + r")\]$")
-_HOST_PORT_PAT = ("^(%s|%s|%s)(?::0*([0-9]{0,5}))?$") % (
+_HOST_PORT_PAT = ("^(%s|%s|%s)(?::0*?(|0|[1-9][0-9]{0,4}))?$") % (
REG_NAME_PAT,
IPV4_PAT,
IPV6_ADDRZ_PAT,
diff --git a/test/test_util.py b/test/test_util.py
index f6c8b43..7d512f5 100644
--- a/test/test_util.py
+++ b/test/test_util.py
@@ -347,6 +347,13 @@ class TestUtil(object):
url = parse_url("https://example.com:0000000000080")
assert url.port == 80
+ def test_parse_url_only_zeros(self):
+ url = parse_url("https://example.com:0")
+ assert url.port == 0
+
+ url = parse_url("https://example.com:000000000000")
+ assert url.port == 0
+
def test_Url_str(self):
U = Url("http", host="google.com")
assert str(U) == U.url
--
2.27.0

View File

@ -1,45 +0,0 @@
From 955da4d03eaa6785aef40a34f440a67d736a4793 Mon Sep 17 00:00:00 2001
From: Seth Michael Larson <sethmichaellarson@gmail.com>
Date: Tue, 22 Nov 2022 17:59:57 +0000
Subject: [PATCH] [1.26] Strip leading zeros from ports
Co-authored-by: Bastian Venthur <bastian.venthur@flixbus.com>
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
Conflict:NA
Reference:https://github.com/urllib3/urllib3/commit/955da4d03eaa6785aef40a34f440a67d736a4793
---
src/urllib3/util/url.py | 2 +-
test/test_util.py | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/urllib3/util/url.py b/src/urllib3/util/url.py
index 81a03da..8964cef 100644
--- a/src/urllib3/util/url.py
+++ b/src/urllib3/util/url.py
@@ -63,7 +63,7 @@ IPV6_ADDRZ_RE = re.compile("^" + IPV6_ADDRZ_PAT + "$")
BRACELESS_IPV6_ADDRZ_RE = re.compile("^" + IPV6_ADDRZ_PAT[2:-2] + "$")
ZONE_ID_RE = re.compile("(" + ZONE_ID_PAT + r")\]$")
-_HOST_PORT_PAT = ("^(%s|%s|%s)(?::([0-9]{0,5}))?$") % (
+_HOST_PORT_PAT = ("^(%s|%s|%s)(?::0*([0-9]{0,5}))?$") % (
REG_NAME_PAT,
IPV4_PAT,
IPV6_ADDRZ_PAT,
diff --git a/test/test_util.py b/test/test_util.py
index 562c106..f6c8b43 100644
--- a/test/test_util.py
+++ b/test/test_util.py
@@ -343,6 +343,10 @@ class TestUtil(object):
with pytest.raises(LocationParseError):
parse_url("https://www.google.com:-80/")
+ def test_parse_url_remove_leading_zeros(self):
+ url = parse_url("https://example.com:0000000000080")
+ assert url.port == 80
+
def test_Url_str(self):
U = Url("http", host="google.com")
assert str(U) == U.url
--
2.27.0

View File

@ -2,8 +2,8 @@
%bcond_without tests
Name: python-%{srcname}
Version: 1.26.12
Release: 5
Version: 1.26.16
Release: 1
Summary: Sanity-friendly HTTP client for Python
License: MIT
URL: https://urllib3.readthedocs.io
@ -12,12 +12,6 @@ Source1: ssl_match_hostname_py3.py
Patch0001: remove_mock.patch
Patch6000: backport-CVE-2021-28363.patch
Patch6001: backport-strip-leading-zeros-form-ports.patch
Patch6002: backport-fixed-issue-with-port-0-returning-None.patch
Patch6003: backport-Fix-socket-timeout-value-when-HTTPConnection-is-reused.patch
Patch6004: backport-Remove-Exclamation-mark-character-from-the-unreserved-characters.patch
Patch6005: backport-Fix-_idna_encode-handling-of-x80.patch
Patch6006: backport-fix-test_ssl_object_attributes.patch
BuildArch: noarch
@ -83,6 +77,12 @@ PYTHONPATH=%{buildroot}%{python3_sitelib}:%{python3_sitelib} %{__python3} -m pyt
%{python3_sitelib}/urllib3-*.egg-info
%changelog
* Mon Jul 31 2023 chengyechun <chengyechun1@huawei.com> - 1.26.16-1
- Type:enhancement
- CVE:NA
- SUG:NA
- DESC:update to 1.26.16
* Tue Jul 25 2023 chengyechun <chengyechun1@huawei.com> - 1.26.12-5
- Type:bugfix
- CVE:NA