/sync fix util.parse_url function traceback when port have leading zeros
This commit is contained in:
parent
ba0529de92
commit
2d54835620
45
backport-strip-leading-zeros-form-ports.patch
Normal file
45
backport-strip-leading-zeros-form-ports.patch
Normal file
@ -0,0 +1,45 @@
|
||||
From 955da4d03eaa6785aef40a34f440a67d736a4793 Mon Sep 17 00:00:00 2001
|
||||
From: Seth Michael Larson <sethmichaellarson@gmail.com>
|
||||
Date: Tue, 22 Nov 2022 17:59:57 +0000
|
||||
Subject: [PATCH] [1.26] Strip leading zeros from ports
|
||||
|
||||
Co-authored-by: Bastian Venthur <bastian.venthur@flixbus.com>
|
||||
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
|
||||
|
||||
Conflict:NA
|
||||
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 81a03da..8964cef 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 562c106..f6c8b43 100644
|
||||
--- a/test/test_util.py
|
||||
+++ b/test/test_util.py
|
||||
@@ -343,6 +343,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
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
Name: python-%{srcname}
|
||||
Version: 1.26.12
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: Sanity-friendly HTTP client for Python
|
||||
License: MIT
|
||||
URL: https://urllib3.readthedocs.io
|
||||
@ -12,6 +12,7 @@ Source1: ssl_match_hostname_py3.py
|
||||
|
||||
Patch0001: remove_mock.patch
|
||||
Patch6000: backport-CVE-2021-28363.patch
|
||||
Patch6001: backport-strip-leading-zeros-form-ports.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
@ -27,10 +28,9 @@ BuildRequires: python3-setuptools
|
||||
%if %{with tests}
|
||||
BuildRequires: python3-cryptography python3-mock python3-six python-idna python-dateutil
|
||||
BuildRequires: python3-pysocks python3-pytest python3-tornado python-trustme
|
||||
BuildRequires: python3-pytest-timeout
|
||||
%endif
|
||||
|
||||
Requires: ca-certificates python3-idna python3-six >= 1.16.0 python3-pysocks
|
||||
Requires: ca-certificates python3-idna python3-six python3-pysocks
|
||||
|
||||
%description -n python3-urllib3
|
||||
Python3 HTTP module with connection pooling and file POST abilities.
|
||||
@ -78,17 +78,23 @@ PYTHONPATH=%{buildroot}%{python3_sitelib}:%{python3_sitelib} %{__python3} -m pyt
|
||||
%{python3_sitelib}/urllib3-*.egg-info
|
||||
|
||||
%changelog
|
||||
* Mon Nov 7 2022 chenhaixing <chenhaixing@huawei.com> - 1.26.12-1
|
||||
- DESC:upgrade python-urllib3 version to 1.26.12
|
||||
* Sat Dec 17 2022 chenhaixing <chenhaixing@huawei.com> - 1.26.12-2
|
||||
- DESC:fix util.parse_url function traceback when port have leading zeros
|
||||
|
||||
* Tue Aug 09 2022 chenhaixing <chenhaixing@huawei.com> - 1.26.7-3
|
||||
- modify RECENT_DATE in python-urllib3.spec to adapt time change
|
||||
* Sun Sep 04 2022 tianlijing <tianlijing@kylinos.cn> - 1.26.12-1
|
||||
- update to 1.26.12
|
||||
|
||||
* Fri Jan 07 2022 zhanzhimin <zhanzhimin@huawei.com> - 1.26.7-2
|
||||
- remove python-nose dependency
|
||||
* Tue Aug 09 2022 chenhaixing <chenhaixing@huawei.com> - 1.26.8-2
|
||||
- delete patch Bump-RECENT_DATE.patch and modify RECENT_DATE in python-urllib3.spec to adapt time change
|
||||
|
||||
* Sat Nov 27 2021 zhanzhimin <zhanzhimin@huawei.com> - 1.26.7-1
|
||||
- update to 1.26.7
|
||||
* Mon Jul 18 2022 OpenStack_SIG <openstack@openeuler.org> - 1.26.8-1
|
||||
- Upgrade package to version 1.26.8
|
||||
|
||||
* Wed Jul 06 2022 chenhaixing <chenhaixing@huawei.com> - 1.26.7-2
|
||||
- add patch Bump RECENT_DATE and solve test case test_recent_date failed
|
||||
|
||||
* Wed Jan 19 2022 wangkerong <wangkerong@huawei.com> - 1.26.7-1
|
||||
- update to 1.26.7 and remove python-nose dependency
|
||||
|
||||
* Mon Jul 5 2021 zhanzhimin <zhanzhimin@huawei.com> - 1.26.3-3
|
||||
- fix CVE-2021-33503
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user