Commit 116094fb authored by Nasko Oskov's avatar Nasko Oskov Committed by Commit Bot

Add default port for the gopher: scheme.

KURL parsing uses known_ports.cc for supporting known ports for standard
schemes. GURL uses its own version, which leads to mismatch in behavior.

This CL adds gopher's default port to known_ports.cc, however a follow
up patch should just remove gopher support in general.

Bug: 894426
Change-Id: I9cde04bef34be39337cdb9f2a584de576d0b15ea
Reviewed-on: https://chromium-review.googlesource.com/c/1279408Reviewed-by: default avatarCharlie Harrison <csharrison@chromium.org>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Commit-Queue: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599812}
parent 012876ae
......@@ -47,6 +47,8 @@ bool IsDefaultPortForProtocol(unsigned short port,
return protocol == "ftp";
case 990:
return protocol == "ftps";
case 70:
return protocol == "gopher";
}
return false;
}
......@@ -60,6 +62,8 @@ unsigned short DefaultPortForProtocol(const WTF::String& protocol) {
return 21;
if (protocol == "ftps")
return 990;
if (protocol == "gopher")
return 70;
return 0;
}
......
......@@ -395,6 +395,7 @@ TEST_F(SecurityOriginTest, CreateFromTuple) {
{"https", "example.com", 444, "https://example.com:444"},
{"file", "", 0, "file://"},
{"file", "example.com", 0, "file://"},
{"gopher", "Foo.com", 70, "gopher://foo.com"},
};
for (const auto& test : cases) {
......@@ -536,6 +537,9 @@ TEST_F(SecurityOriginTest, UrlOriginConversions) {
123},
{"blob:https://example.com/guid-goes-here", "https", "example.com", 443},
{"blob:http://u:p@example.com/guid-goes-here", "http", "example.com", 80},
// Gopher:
{"gopher://8u.9.Vx6/", "gopher", "8u.9.vx6", 70},
};
for (const auto& test_case : cases) {
......
......@@ -352,6 +352,9 @@ TEST_F(OriginTest, ConstructFromGURL) {
123},
{"blob:https://example.com/guid-goes-here", "https", "example.com", 443},
{"blob:http://u:p@example.com/guid-goes-here", "http", "example.com", 80},
// Gopher:
{"gopher://8u.9.Vx6", "gopher", "8u.9.vx6", 70},
};
for (const auto& test_case : cases) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment