Skip to content

Commit

Permalink
Bug 1720566 [wpt PR 29666] - Update URL tests to reject hostnames tha…
Browse files Browse the repository at this point in the history
…t end in numbers but are not IPv4 IPs, a=testonly

Automatic update from web-platform-tests
Reject hostnames that end in numbers but are not IPv4 IPs

Follows whatwg/url#619, and adds more coverage to this area generally.
--

wpt-commits: a85b7d62bd2788e36e6e83c043f86b3ba1e6a9ec
wpt-pr: 29666
  • Loading branch information
MattMenke2 authored and moz-wptsync-bot committed Jul 31, 2021
1 parent adf7d7a commit 57eb549
Showing 1 changed file with 186 additions and 44 deletions.
230 changes: 186 additions & 44 deletions testing/web-platform/tests/url/resources/urltestdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3896,21 +3896,6 @@
"search": "",
"hash": ""
},
{
"input": "http://0..0x300/",
"base": "about:blank",
"href": "http://0..0x300/",
"origin": "http://0..0x300",
"protocol": "http:",
"username": "",
"password": "",
"host": "0..0x300",
"hostname": "0..0x300",
"port": "",
"pathname": "/",
"search": "",
"hash": ""
},
"Broken IPv6",
{
"input": "http://[www.google.com]/",
Expand Down Expand Up @@ -5161,6 +5146,36 @@
"hash": "#foo%60bar"
},
"# IPv4 parsing (via https://github.com/nodejs/node/pull/10317)",
{
"input": "http://1.2.3.4/",
"base": "http://other.com/",
"href": "http://1.2.3.4/",
"origin": "http://1.2.3.4",
"protocol": "http:",
"username": "",
"password": "",
"host": "1.2.3.4",
"hostname": "1.2.3.4",
"port": "",
"pathname": "/",
"search": "",
"hash": ""
},
{
"input": "http://1.2.3.4./",
"base": "http://other.com/",
"href": "http://1.2.3.4/",
"origin": "http://1.2.3.4",
"protocol": "http:",
"username": "",
"password": "",
"host": "1.2.3.4",
"hostname": "1.2.3.4",
"port": "",
"pathname": "/",
"search": "",
"hash": ""
},
{
"input": "http://192.168.257",
"base": "http://other.com/",
Expand All @@ -5176,6 +5191,21 @@
"search": "",
"hash": ""
},
{
"input": "http://192.168.257.",
"base": "http://other.com/",
"href": "http://192.168.1.1/",
"origin": "http://192.168.1.1",
"protocol": "http:",
"username": "",
"password": "",
"host": "192.168.1.1",
"hostname": "192.168.1.1",
"port": "",
"pathname": "/",
"search": "",
"hash": ""
},
{
"input": "http://192.168.257.com",
"base": "http://other.com/",
Expand Down Expand Up @@ -5236,6 +5266,21 @@
"search": "",
"hash": ""
},
{
"input": "http://999999999.",
"base": "http://other.com/",
"href": "http://59.154.201.255/",
"origin": "http://59.154.201.255",
"protocol": "http:",
"username": "",
"password": "",
"host": "59.154.201.255",
"hostname": "59.154.201.255",
"port": "",
"pathname": "/",
"search": "",
"hash": ""
},
{
"input": "http://999999999.com",
"base": "http://other.com/",
Expand Down Expand Up @@ -5316,21 +5361,6 @@
"base": "http://other.com/",
"failure": true
},
{
"input": "http://256.256.256.256.256",
"base": "http://other.com/",
"href": "http://256.256.256.256.256/",
"origin": "http://256.256.256.256.256",
"protocol": "http:",
"username": "",
"password": "",
"host": "256.256.256.256.256",
"hostname": "256.256.256.256.256",
"port": "",
"pathname": "/",
"search": "",
"hash": ""
},
{
"input": "https://0x.0x.0",
"base": "about:blank",
Expand Down Expand Up @@ -7298,20 +7328,6 @@
"hash": ""
},
"Invalid IPv4 radix digits",
{
"input": "http://0177.0.0.0189",
"base": "about:blank",
"href": "http://0177.0.0.0189/",
"protocol": "http:",
"username": "",
"password": "",
"host": "0177.0.0.0189",
"hostname": "0177.0.0.0189",
"port": "",
"pathname": "/",
"search": "",
"hash": ""
},
{
"input": "http://0x7f.0.0.0x7g",
"base": "about:blank",
Expand Down Expand Up @@ -8031,5 +8047,131 @@
"input": "?",
"base": null,
"failure": true
},
"Last component looks like a number, but not valid IPv4",
{
"input": "http://1.2.3.4.5",
"base": "http://other.com/",
"failure": true
},
{
"input": "http://1.2.3.4.5.",
"base": "http://other.com/",
"failure": true
},
{
"input": "http://0..0x300/",
"base": "about:blank",
"failure": true
},
{
"input": "http://0..0x300./",
"base": "about:blank",
"failure": true
},
{
"input": "http://256.256.256.256.256",
"base": "http://other.com/",
"failure": true
},
{
"input": "http://256.256.256.256.256.",
"base": "http://other.com/",
"failure": true
},
{
"input": "http://1.2.3.08",
"base": "about:blank",
"failure": true
},
{
"input": "http://1.2.3.08.",
"base": "about:blank",
"failure": true
},
{
"input": "http://1.2.3.09",
"base": "about:blank",
"failure": true
},
{
"input": "http://09.2.3.4",
"base": "about:blank",
"failure": true
},
{
"input": "http://09.2.3.4.",
"base": "about:blank",
"failure": true
},
{
"input": "http://01.2.3.4.5",
"base": "about:blank",
"failure": true
},
{
"input": "http://01.2.3.4.5.",
"base": "about:blank",
"failure": true
},
{
"input": "http://0x100.2.3.4",
"base": "about:blank",
"failure": true
},
{
"input": "http://0x100.2.3.4.",
"base": "about:blank",
"failure": true
},
{
"input": "http://0x1.2.3.4.5",
"base": "about:blank",
"failure": true
},
{
"input": "http://0x1.2.3.4.5.",
"base": "about:blank",
"failure": true
},
{
"input": "http://foo.1.2.3.4",
"base": "about:blank",
"failure": true
},
{
"input": "http://foo.1.2.3.4.",
"base": "about:blank",
"failure": true
},
{
"input": "http://foo.2.3.4",
"base": "about:blank",
"failure": true
},
{
"input": "http://foo.2.3.4.",
"base": "about:blank",
"failure": true
},
{
"input": "http://foo.09",
"base": "about:blank",
"failure": true
},
{
"input": "http://foo.09.",
"base": "about:blank",
"failure": true
},
{
"input": "http://foo.0x4",
"base": "about:blank",
"failure": true
},
{
"input": "http://foo.0x4.",
"base": "about:blank",
"failure": true
}
]

0 comments on commit 57eb549

Please sign in to comment.