Skip to content

Commit

Permalink
Support IPv6 literals in KURL::SetHostAndPort
Browse files Browse the repository at this point in the history
KURL::SetHostAndPort would corrupt IPv6 literals because they contain
":" characters. Make it check for "[]" characters and use the first ":"
after an IPv6 address as the start of the port number if one is present.

Fixed: 1012416
Change-Id: If07a671b48c8c1b24b16883fb9072a86b0de7ebc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1871449
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Adam Rice <ricea@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710668}
  • Loading branch information
ricea authored and chromium-wpt-export-bot committed Oct 30, 2019
1 parent f2f0130 commit 5e2d3b3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions url/resources/setters_tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,17 @@
"port": "2"
}
},
{
"comment": "IPv6 literal address with port, crbug.com/1012416",
"href": "http://example.net",
"new_value": "[2001:db8::2]:4002",
"expected": {
"href": "http://[2001:db8::2]:4002/",
"host": "[2001:db8::2]:4002",
"hostname": "[2001:db8::2]",
"port": "4002"
}
},
{
"comment": "Default port number is removed",
"href": "http://example.net",
Expand Down

0 comments on commit 5e2d3b3

Please sign in to comment.