summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-06 05:06:20 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-06 05:06:20 +0000
commit7fc13edf63fcb30391edec083ea496809607917a (patch)
tree16d7123511520ba9b7f1ca1d36093bdc71dc97d1 /chrome/browser/net
parent309d27740389acc1cfdda031b8fb43781e6022a3 (diff)
downloadchromium_src-7fc13edf63fcb30391edec083ea496809607917a.zip
chromium_src-7fc13edf63fcb30391edec083ea496809607917a.tar.gz
chromium_src-7fc13edf63fcb30391edec083ea496809607917a.tar.bz2
Pulls the latest googleurl to get the fix for
BUG=http://crbug.com/160 and integrates the update to IsStandard in that version. Adds several internal schemes as "standard" and initializes them at startup. Fixes a few hardcoded URL schemes I noticed. Make typing "//foo" into the URL bar treat slashes in "strict" mode on Windows, which means we'll only accept UNC if you use backslashes. This matches IE's behavior. BUG=http://crbug.com/33038 TEST=covered by unit tests git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40818 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r--chrome/browser/net/url_fixer_upper.cc8
-rw-r--r--chrome/browser/net/url_fixer_upper_unittest.cc10
2 files changed, 13 insertions, 5 deletions
diff --git a/chrome/browser/net/url_fixer_upper.cc b/chrome/browser/net/url_fixer_upper.cc
index 6909ddf..cc85420 100644
--- a/chrome/browser/net/url_fixer_upper.cc
+++ b/chrome/browser/net/url_fixer_upper.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -399,7 +399,7 @@ string URLFixerUpper::SegmentURL(const string& text,
#if defined(OS_WIN)
int trimmed_length = static_cast<int>(trimmed.length());
if (url_parse::DoesBeginWindowsDriveSpec(trimmed.data(), 0, trimmed_length) ||
- url_parse::DoesBeginUNCPath(trimmed.data(), 0, trimmed_length, false))
+ url_parse::DoesBeginUNCPath(trimmed.data(), 0, trimmed_length, true))
return "file";
#elif defined(OS_POSIX)
if (FilePath::IsSeparator(trimmed.data()[0]) || trimmed.data()[0] == '~')
@@ -417,7 +417,7 @@ string URLFixerUpper::SegmentURL(const string& text,
// Not segmenting file schemes or nonstandard schemes.
if ((scheme == chrome::kFileScheme) ||
- !url_util::IsStandard(scheme.c_str(), static_cast<int>(scheme.length()),
+ !url_util::IsStandard(scheme.c_str(),
url_parse::Component(0, static_cast<int>(scheme.length()))))
return scheme;
@@ -476,7 +476,7 @@ string URLFixerUpper::FixupURL(const string& text,
return (parts.scheme.is_valid() ? text : FixupPath(text));
// For some schemes whose layouts we understand, we rebuild it.
- if (url_util::IsStandard(scheme.c_str(), static_cast<int>(scheme.length()),
+ if (url_util::IsStandard(scheme.c_str(),
url_parse::Component(0, static_cast<int>(scheme.length())))) {
string url(scheme);
url.append("://");
diff --git a/chrome/browser/net/url_fixer_upper_unittest.cc b/chrome/browser/net/url_fixer_upper_unittest.cc
index a9d77ed..2205f73 100644
--- a/chrome/browser/net/url_fixer_upper_unittest.cc
+++ b/chrome/browser/net/url_fixer_upper_unittest.cc
@@ -342,8 +342,16 @@ TEST(URLFixerUpperTest, FixupFile) {
// should be returned just converted to a file: URL.
{"\\\\SomeNonexistentHost\\foo\\bar.txt", "",
"file://somenonexistenthost/foo/bar.txt"},
+ // We do this strictly, like IE8, which only accepts this form using
+ // backslashes and not forward ones. Its a bit weird that the host/path is
+ // "more canonicalized" in the UNC case above, and in the http case it
+ // isn't lowercased, etc. That level of canonicalization will happen when
+ // it's actually turned into a GURL, so we don't care about it here. Turning
+ // "//foo" into "http" matches Firefox and IE, silly though it may seem
+ // (it falls out of adding "http" as the default protocol if you haven't
+ // entered one).
{"//SomeNonexistentHost\\foo/bar.txt", "",
- "file://somenonexistenthost/foo/bar.txt"},
+ "http://SomeNonexistentHost\\foo/bar.txt"},
{"file:///C:/foo/bar", "", "file:///C:/foo/bar"},
// These are fixups we don't do, but could consider: