python-urllib3/backport-fix-NRESERVED_PAT-and-_idna_encode.patch
xzf1234 2c10fe0201 fix field NRESERVED_PAT and function _idna_encode that will cause bugs
(cherry picked from commit 109150f1e1eb928f0cd64bc2db19edc39d905abe)
2023-04-24 15:41:15 +08:00

35 lines
1.1 KiB
Diff

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