diff --git a/AK/URLParser.cpp b/AK/URLParser.cpp index 5d05979347..6b3c4cdc7c 100644 --- a/AK/URLParser.cpp +++ b/AK/URLParser.cpp @@ -250,6 +250,11 @@ static void serialize_ipv6_address(URL::IPv6Address const& address, StringBuilde } } + if (current_sequence_length > longest_sequence_length) { + longest_sequence_length = current_sequence_length; + compress = current_sequence_start; + } + // 3. If there is no sequence of address’s IPv6 pieces that are 0 that is longer than 1, then set compress to null. if (longest_sequence_length <= 1) compress = {}; diff --git a/Tests/LibWeb/Text/expected/URL/url.txt b/Tests/LibWeb/Text/expected/URL/url.txt index 3f88ac429b..cad194eaac 100644 --- a/Tests/LibWeb/Text/expected/URL/url.txt +++ b/Tests/LibWeb/Text/expected/URL/url.txt @@ -25,3 +25,12 @@ hostname => '[1:0:1:0:1:0:1:0]' port => '' pathname => '/' search => '' +http://[1:1:0:0:1:0:0:0]/ +protocol => 'http:' +username => '' +password => '' +host => '[1:1:0:0:1::]' +hostname => '[1:1:0:0:1::]' +port => '' +pathname => '/' +search => '' diff --git a/Tests/LibWeb/Text/input/URL/url.html b/Tests/LibWeb/Text/input/URL/url.html index 3626fa9b97..041f775b93 100644 --- a/Tests/LibWeb/Text/input/URL/url.html +++ b/Tests/LibWeb/Text/input/URL/url.html @@ -18,6 +18,7 @@ 'ftp://serenityos.org:21', 'http://[0:1:0:1:0:1:0:1]', 'http://[1:0:1:0:1:0:1:0]', + 'http://[1:1:0:0:1:0:0:0]/', ]) { printURL(url); }