代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/python-urllib3 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。