Make IPv6-embedded IPv4 addresses parse only if they have 4 parts (#38484)
The URL standard requires the IPv6-embedded IPv4 address to be consicely
composed of 4 parts. A check is added in the URL host parser to fix the
WPT test failures.
The feature is implemented behind the StrictIPv6EmbeddedIPv4AddressParsing flag.
Bug: 1411619
Change-Id: I9062aef7279b899db961613b6e42f6095d2101d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4206417
Reviewed-by: Tommy Li <tommycli@chromium.org>
Reviewed-by: Charlie Harrison <csharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Jiacheng Guo <gjc@google.com>
Reviewed-by: Weizhong Xia <weizhong@google.com>
Cr-Commit-Position: refs/heads/main@{#1106646}
Co-authored-by: Jiacheng Guo <gjc@chromium.org>
diff --git a/url/resources/urltestdata.json b/url/resources/urltestdata.json
index 0265346..94d41c0 100644
--- a/url/resources/urltestdata.json
+++ b/url/resources/urltestdata.json
@@ -965,6 +965,21 @@
"hash": ""
},
{
+ "input": "http://[::127.0.0.1.]",
+ "base": "http://example.org/foo/bar",
+ "href": "http://[::7f00:1]/",
+ "origin": "http://[::7f00:1]",
+ "protocol": "http:",
+ "username": "",
+ "password": "",
+ "host": "[::7f00:1]",
+ "hostname": "[::7f00:1]",
+ "port": "",
+ "pathname": "/",
+ "search": "",
+ "hash": ""
+ },
+ {
"input": "http://[0:0:0:0:0:0:13.1.68.3]",
"base": "http://example.org/foo/bar",
"href": "http://[::d01:4403]/",
@@ -3960,11 +3975,21 @@
"failure": true
},
{
+ "input": "http://[::.1.2]",
+ "base": "http://other.com/",
+ "failure": true
+ },
+ {
"input": "http://[::1.]",
"base": "http://other.com/",
"failure": true
},
{
+ "input": "http://[::.1]",
+ "base": "http://other.com/",
+ "failure": true
+ },
+ {
"input": "http://[::%31]",
"base": "http://other.com/",
"failure": true