File tree 2 files changed +7
-1
lines changed
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 87
87
88
88
# We use these simple regexs as a first pass before handing off to
89
89
# the stdlib 'ipaddress' module for IP address validation.
90
- IPv4_STYLE_HOSTNAME = re .compile (r"^[0-9]+.[0-9]+.[0-9]+.[0-9]+$" )
90
+ IPv4_STYLE_HOSTNAME = re .compile (r"^[0-9]+\ .[0-9]+\ .[0-9]+\ .[0-9]+$" )
91
91
IPv6_STYLE_HOSTNAME = re .compile (r"^\[.*\]$" )
92
92
93
93
Original file line number Diff line number Diff line change @@ -45,6 +45,12 @@ def test_urlparse_normalized_host():
45
45
assert url .host == "example.com"
46
46
47
47
48
+ def test_urlparse_ipv4_like_host ():
49
+ """rare host names used to quality as IPv4"""
50
+ url = httpx .URL ("https://023b76x43144/" )
51
+ assert url .host == "023b76x43144"
52
+
53
+
48
54
def test_urlparse_valid_ipv4 ():
49
55
url = httpx .URL ("https://1.2.3.4/" )
50
56
assert url .host == "1.2.3.4"
You can’t perform that action at this time.
0 commit comments