summaryrefslogtreecommitdiffstats
path: root/url/url_canon_relative.cc
diff options
context:
space:
mode:
authortsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-18 22:55:31 +0000
committertsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-18 22:55:31 +0000
commit598c8382c9e0556f16a486d758c61d108b4732e0 (patch)
treec3133ca8061e4eee70d10060d84fb1f04bd6621c /url/url_canon_relative.cc
parentb887a2620262a8b51be8973cbd366e03e5ddaed9 (diff)
downloadchromium_src-598c8382c9e0556f16a486d758c61d108b4732e0.zip
chromium_src-598c8382c9e0556f16a486d758c61d108b4732e0.tar.gz
chromium_src-598c8382c9e0556f16a486d758c61d108b4732e0.tar.bz2
Make relative file url parsing fail where there is a host:port in the relative URL.
BUG=285720 R=brettw@chromium.org, jar@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=223928 Review URL: https://codereview.chromium.org/23464046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223969 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'url/url_canon_relative.cc')
-rw-r--r--url/url_canon_relative.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/url/url_canon_relative.cc b/url/url_canon_relative.cc
index 84317f8..4edd6ced 100644
--- a/url/url_canon_relative.cc
+++ b/url/url_canon_relative.cc
@@ -475,11 +475,14 @@ bool DoResolveRelativeURL(const char* base_url,
#else
// Other platforms need explicit handling for file: URLs with multiple
// slashes because the generic scheme parsing always extracts a host, but a
- // file: URL only has a host if it has exactly 2 slashes. This also
- // handles the special case where the URL is only slashes, since that
- // doesn't have a host part either.
+ // file: URL only has a host if it has exactly 2 slashes. Even if it does
+ // have a host, we want to use the special host detection logic for file
+ // URLs provided by DoResolveAbsoluteFile(), as opposed to the generic host
+ // detection logic, for consistency with parsing file URLs from scratch.
+ // This also handles the special case where the URL is only slashes,
+ // since that doesn't have a host part either.
if (base_is_file &&
- (num_slashes > 2 || num_slashes == relative_component.len)) {
+ (num_slashes >= 2 || num_slashes == relative_component.len)) {
return DoResolveAbsoluteFile(relative_url, relative_component,
query_converter, output, out_parsed);
}