From 109150f1e1eb928f0cd64bc2db19edc39d905abe Mon Sep 17 00:00:00 2001 From: xzf1234 Date: Sun, 23 Apr 2023 20:30:43 +0800 Subject: [PATCH] fix field NRESERVED_PAT and function _idna_encode that will cause bugs --- ...t-fix-NRESERVED_PAT-and-_idna_encode.patch | 34 +++++++++++++++++++ python-urllib3.spec | 9 ++++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 backport-fix-NRESERVED_PAT-and-_idna_encode.patch diff --git a/backport-fix-NRESERVED_PAT-and-_idna_encode.patch b/backport-fix-NRESERVED_PAT-and-_idna_encode.patch new file mode 100644 index 0000000..c3bb4d2 --- /dev/null +++ b/backport-fix-NRESERVED_PAT-and-_idna_encode.patch @@ -0,0 +1,34 @@ +From b7c63ba938344c8911b4c3b32faf8d0029f879e6 Mon Sep 17 00:00:00 2001 +From: xzf1234 +Date: Sun, 23 Apr 2023 20:25:38 +0800 +Subject: [PATCH] second + +--- + urllib3-1.25.9/src/urllib3/util/url.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/urllib3/util/url.py b/src/urllib3/util/url.py +index 793324e..2f7fdaa 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")?\]" +@@ -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.33.1.windows.1 + diff --git a/python-urllib3.spec b/python-urllib3.spec index ec58512..6e0dcf8 100644 --- a/python-urllib3.spec +++ b/python-urllib3.spec @@ -3,7 +3,7 @@ Name: python-%{srcname} Version: 1.25.9 -Release: 7 +Release: 8 Summary: Sanity-friendly HTTP client for Python License: MIT URL: https://urllib3.readthedocs.io @@ -18,6 +18,7 @@ Patch6002: backport-Do-not-insert-None-into-ConnectionPool-if-it-was-empty. 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 +Patch6006: backport-fix-NRESERVED_PAT-and-_idna_encode.patch %global _description \ HTTP library with thread-safe connection pooling, file post support,\ @@ -119,6 +120,12 @@ PYTHONPATH=%{buildroot}%{python3_sitelib}:%{python3_sitelib} %{__python3} -m pyt %{python3_sitelib}/urllib3-*.egg-info %changelog +* Sun Apr 23 2023 xzf1244 - 1.25.9-8 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:fix field NRESERVED_PAT and function _idna_encode that will cause bugs + * Thu Jan 19 2023 chenhaixing - 1.25.9-7 - Type:bugfix - CVE:NA -- Gitee