fix field NRESERVED_PAT and function _idna_encode that will cause bugs

(cherry picked from commit 109150f1e1eb928f0cd64bc2db19edc39d905abe)
This commit is contained in:
xzf1234 2023-04-23 20:30:43 +08:00 committed by openeuler-sync-bot
parent bbc7a59768
commit 2c10fe0201
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,34 @@
From b7c63ba938344c8911b4c3b32faf8d0029f879e6 Mon Sep 17 00:00:00 2001
From: xzf1234 <xzff@hust.edu.cn>
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

View File

@ -3,7 +3,7 @@
Name: python-%{srcname} Name: python-%{srcname}
Version: 1.25.9 Version: 1.25.9
Release: 7 Release: 8
Summary: Sanity-friendly HTTP client for Python Summary: Sanity-friendly HTTP client for Python
License: MIT License: MIT
URL: https://urllib3.readthedocs.io 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 Patch6003: backport-add-server_hostname-to-SSL_KEYWORDS.patch
Patch6004: backport-strip-leading-zeros-form-ports.patch Patch6004: backport-strip-leading-zeros-form-ports.patch
Patch6005: backport-fixed-issue-with-port-0-returning-None.patch Patch6005: backport-fixed-issue-with-port-0-returning-None.patch
Patch6006: backport-fix-NRESERVED_PAT-and-_idna_encode.patch
%global _description \ %global _description \
HTTP library with thread-safe connection pooling, file post support,\ 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 %{python3_sitelib}/urllib3-*.egg-info
%changelog %changelog
* Sun Apr 23 2023 xzf1244 <xzff@hust.edu.cn> - 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 <chenhaixing@huawei.com> - 1.25.9-7 * Thu Jan 19 2023 chenhaixing <chenhaixing@huawei.com> - 1.25.9-7
- Type:bugfix - Type:bugfix
- CVE:NA - CVE:NA