diff --git a/backport-add-server_hostname-to-SSL_KEYWORDS.patch b/backport-add-server_hostname-to-SSL_KEYWORDS.patch new file mode 100644 index 0000000000000000000000000000000000000000..6d857f7c6f7aabf9fbe8a99fd1085e409805c16b --- /dev/null +++ b/backport-add-server_hostname-to-SSL_KEYWORDS.patch @@ -0,0 +1,25 @@ +From f1d40fd07f7b5d9cf846a18fb5a920b4be07dfc5 Mon Sep 17 00:00:00 2001 +From: Hasan Ramezani +Date: Thu, 20 Jan 2022 15:56:02 +0100 +Subject: [PATCH] [1.26] Add server_hostname to SSL_KEYWORDS + +Conflict:no add testcode +Reference:https://github.com/urllib3/urllib3/commit/f1d40fd07f7b5d9cf846a18fb5a920b4be07dfc5 +--- + src/urllib3/poolmanager.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/urllib3/poolmanager.py b/src/urllib3/poolmanager.py +index 3a31a28..ca4ec34 100644 +--- a/src/urllib3/poolmanager.py ++++ b/src/urllib3/poolmanager.py +@@ -34,6 +34,7 @@ SSL_KEYWORDS = ( + "ca_cert_dir", + "ssl_context", + "key_password", ++ "server_hostname", + ) + + # All known keyword arguments that could be provided to the pool manager, its +-- +2.27.0 diff --git a/backport-fixed-issue-with-port-0-returning-None.patch b/backport-fixed-issue-with-port-0-returning-None.patch new file mode 100644 index 0000000000000000000000000000000000000000..1e7de5901ae077df3099b3ff0917fae6254ace3a --- /dev/null +++ b/backport-fixed-issue-with-port-0-returning-None.patch @@ -0,0 +1,47 @@ +From 7b6049c4d7551c0a3d04e213b853ef33b8ed1cd9 Mon Sep 17 00:00:00 2001 +From: Bastian Venthur +Date: Fri, 9 Dec 2022 21:47:14 +0100 +Subject: [PATCH] fixed issue with port "0" returning None + +Conflict:adapt: +1.no change changelog/2850.bugfix.rst +2.The content of "@@" is adapted +Reference:https://github.com/urllib3/urllib3/pull/2849 +--- + 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 6793de3..701ad75 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,5}))?$") % ( + REG_NAME_PAT, + IPV4_PAT, + IPV6_ADDRZ_PAT, +diff --git a/test/test_util.py b/test/test_util.py +index 165a331..c8729e8 100644 +--- a/test/test_util.py ++++ b/test/test_util.py +@@ -343,6 +343,13 @@ class TestUtil(object): + url = parse_url("https://example.com:0000000000080") + assert url.port == 80 + ++ def test_parse_url_only_zeros(self) -> None: ++ 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 \ No newline at end of file diff --git a/backport-strip-leading-zeros-form-ports.patch b/backport-strip-leading-zeros-form-ports.patch new file mode 100644 index 0000000000000000000000000000000000000000..835c9b61eec03a57794ff2d147741b8b59a20037 --- /dev/null +++ b/backport-strip-leading-zeros-form-ports.patch @@ -0,0 +1,46 @@ +From 955da4d03eaa6785aef40a34f440a67d736a4793 Mon Sep 17 00:00:00 2001 +From: Seth Michael Larson +Date: Tue, 22 Nov 2022 17:59:57 +0000 +Subject: [PATCH] [1.26] Strip leading zeros from ports + +Co-authored-by: Bastian Venthur +Co-authored-by: Hasan Ramezani + +Conflict:adapt:The line number of test_parse_url_remove_leading_zeros is adapted. +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 318a6d6..6793de3 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 ef6aa11..165a331 100644 +--- a/test/test_util.py ++++ b/test/test_util.py +@@ -339,6 +339,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 + \ No newline at end of file diff --git a/python-urllib3.spec b/python-urllib3.spec index 3ae8829e16b7dc7c871c426b6c537d3e7596facb..e1483908d0178eab815849097447b215539ea005 100644 --- a/python-urllib3.spec +++ b/python-urllib3.spec @@ -3,7 +3,7 @@ Name: python-%{srcname} Version: 1.25.9 -Release: 5 +Release: 6 Summary: Sanity-friendly HTTP client for Python License: MIT URL: https://urllib3.readthedocs.io @@ -15,6 +15,9 @@ Patch0000: set-RECENT_DATE-not-be-older-than-2-years.patch Patch6000: backport-CVE-2021-33503.patch Patch6001: backport-Change-TARPIT_HOST-to-detect-isolated-network.patch Patch6002: backport-Do-not-insert-None-into-ConnectionPool-if-it-was-empty.patch +Patch6003: backport-add-server_hostname-to-SSL_KEYWORDS.patch +Patch6004: backport-strip-leading-zeros-form-ports.patch +Patch6005: backport-fixed-issue-with-port-0-returning-None.patch %global _description \ HTTP library with thread-safe connection pooling, file post support,\ @@ -116,6 +119,12 @@ PYTHONPATH=%{buildroot}%{python3_sitelib}:%{python3_sitelib} %{__python3} -m pyt %{python3_sitelib}/urllib3-*.egg-info %changelog +* Mon Jan 16 2023 chenhaixing - 1.25.9-6 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:backport some patches + * Thu Jan 5 2023 chenhaixing - 1.25.9-5 - Type:bugfix - CVE:NA