File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 63
63
BRACELESS_IPV6_ADDRZ_RE = re .compile ("^" + IPV6_ADDRZ_PAT [2 :- 2 ] + "$" )
64
64
ZONE_ID_RE = re .compile ("(" + ZONE_ID_PAT + r")\]$" )
65
65
66
- _HOST_PORT_PAT = ("^(%s|%s|%s)(?::0*([ 0-9]{0,5 }))?$" ) % (
66
+ _HOST_PORT_PAT = ("^(%s|%s|%s)(?::0*?(|0|[1-9][ 0-9]{0,4 }))?$" ) % (
67
67
REG_NAME_PAT ,
68
68
IPV4_PAT ,
69
69
IPV6_ADDRZ_PAT ,
Original file line number Diff line number Diff line change @@ -351,6 +351,13 @@ def test_parse_url_remove_leading_zeros(self):
351
351
url = parse_url ("https://example.com:0000000000080" )
352
352
assert url .port == 80
353
353
354
+ def test_parse_url_only_zeros (self ):
355
+ url = parse_url ("https://example.com:0" )
356
+ assert url .port == 0
357
+
358
+ url = parse_url ("https://example.com:000000000000" )
359
+ assert url .port == 0
360
+
354
361
def test_Url_str (self ):
355
362
U = Url ("http" , host = "google.com" )
356
363
assert str (U ) == U .url
You can’t perform that action at this time.
0 commit comments