Bug 1314859 - SetHost should also call NormalizeIPv4 r=mcmanus

MozReview-Commit-ID: 79sQrld6TBG
This commit is contained in:
Valentin Gosu 2016-11-06 23:26:04 +01:00
Родитель 7508e8b67f
Коммит 627f600a3e
3 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -1928,6 +1928,12 @@ nsStandardURL::SetHost(const nsACString &input)
return rv;
}
nsAutoCString ipString;
rv = NormalizeIPv4(hostBuf, ipString);
if (NS_SUCCEEDED(rv)) {
hostBuf = ipString;
}
// NormalizeIDN always copies if the call was successful
host = hostBuf.get();
len = hostBuf.Length();

Просмотреть файл

@ -179,9 +179,9 @@ add_test(function test_ipv6()
url = stringToURL("http://example.com");
url.hostPort = "2001:1";
do_check_eq(url.host, "2001");
do_check_eq(url.host, "0.0.7.209");
do_check_eq(url.port, 1);
do_check_eq(url.hostPort, "2001:1");
do_check_eq(url.hostPort, "0.0.7.209:1");
run_next_test();
});

Просмотреть файл

@ -63,9 +63,6 @@
[Setting <a:/foo>.host = 'example.net' Path-only URLs can gain a host]
expected: FAIL
[Setting <http://example.net>.host = '0x7F000001:8080' IPv4 address syntax is normalized]
expected: FAIL
[Setting <http://example.net>.host = '[::0:01\]:2' IPv6 address syntax is normalized]
expected: FAIL
@ -81,9 +78,6 @@
[Setting <a:/foo>.hostname = 'example.net' Path-only URLs can gain a host]
expected: FAIL
[Setting <http://example.net:8080>.hostname = '0x7F000001' IPv4 address syntax is normalized]
expected: FAIL
[Setting <http://example.net>.hostname = '[::0:01\]' IPv6 address syntax is normalized]
expected: FAIL