mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:58:11 +00:00
AK: Fix missing step step for serialization of IPv6 hosts
This was resulting in the incorrect host serialization of: http://[0:1:0:1:0:1:0:1] to [::1:0:1:0:1:0:1] and: http://[1:0:1:0:1:0:1:0] to [1::1:0:1:0:1:0]
This commit is contained in:
parent
4fdd4dd979
commit
aa7ca80d7c
3 changed files with 25 additions and 1 deletions
|
@ -232,7 +232,6 @@ static void serialize_ipv6_address(URL::IPv6Address const& address, StringBuilde
|
||||||
// 1. Let output be the empty string.
|
// 1. Let output be the empty string.
|
||||||
|
|
||||||
// 2. Let compress be an index to the first IPv6 piece in the first longest sequences of address’s IPv6 pieces that are 0.
|
// 2. Let compress be an index to the first IPv6 piece in the first longest sequences of address’s IPv6 pieces that are 0.
|
||||||
// 3. If there is no sequence of address’s IPv6 pieces that are 0 that is longer than 1, then set compress to null.
|
|
||||||
Optional<size_t> compress;
|
Optional<size_t> compress;
|
||||||
size_t longest_sequence_length = 0;
|
size_t longest_sequence_length = 0;
|
||||||
size_t current_sequence_length = 0;
|
size_t current_sequence_length = 0;
|
||||||
|
@ -250,6 +249,11 @@ static void serialize_ipv6_address(URL::IPv6Address const& address, StringBuilde
|
||||||
current_sequence_length = 0;
|
current_sequence_length = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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 = {};
|
||||||
|
|
||||||
// 4. Let ignore0 be false.
|
// 4. Let ignore0 be false.
|
||||||
auto ignore0 = false;
|
auto ignore0 = false;
|
||||||
|
|
||||||
|
|
|
@ -7,3 +7,21 @@ hostname => 'serenityos.org'
|
||||||
port => ''
|
port => ''
|
||||||
pathname => '/'
|
pathname => '/'
|
||||||
search => ''
|
search => ''
|
||||||
|
http://[0:1:0:1:0:1:0:1]
|
||||||
|
protocol => 'http:'
|
||||||
|
username => ''
|
||||||
|
password => ''
|
||||||
|
host => '[0:1:0:1:0:1:0:1]'
|
||||||
|
hostname => '[0:1:0:1:0:1:0:1]'
|
||||||
|
port => ''
|
||||||
|
pathname => '/'
|
||||||
|
search => ''
|
||||||
|
http://[1:0:1:0:1:0:1:0]
|
||||||
|
protocol => 'http:'
|
||||||
|
username => ''
|
||||||
|
password => ''
|
||||||
|
host => '[1:0:1:0:1:0:1:0]'
|
||||||
|
hostname => '[1:0:1:0:1:0:1:0]'
|
||||||
|
port => ''
|
||||||
|
pathname => '/'
|
||||||
|
search => ''
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
for (url of [
|
for (url of [
|
||||||
'ftp://serenityos.org:21',
|
'ftp://serenityos.org:21',
|
||||||
|
'http://[0:1:0:1:0:1:0:1]',
|
||||||
|
'http://[1:0:1:0:1:0:1:0]',
|
||||||
]) {
|
]) {
|
||||||
printURL(url);
|
printURL(url);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue