summaryrefslogtreecommitdiffstats
path: root/chrome/browser/url_fixer_upper.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/url_fixer_upper.cc')
-rw-r--r--chrome/browser/url_fixer_upper.cc15
1 files changed, 5 insertions, 10 deletions
diff --git a/chrome/browser/url_fixer_upper.cc b/chrome/browser/url_fixer_upper.cc
index a62694d..8ad4fbb 100644
--- a/chrome/browser/url_fixer_upper.cc
+++ b/chrome/browser/url_fixer_upper.cc
@@ -287,16 +287,11 @@ wstring URLFixerUpper::SegmentURL(const wstring& text,
parts->scheme.reset();
}
- // Check to see if we've found a scheme we liked.
- int scheme_end;
- if (parts->scheme.is_valid()) {
- // Remember the end of the scheme.
- scheme_end = parts->scheme.end();
- } else {
- // Having been unable to extract a scheme, we default to HTTP.
- scheme.assign(L"http");
- scheme_end = 0;
- }
+ // When we couldn't find a scheme in the input, we need to pick one. Normally
+ // we choose http, but if the URL starts with "ftp.", we match other browsers
+ // and choose ftp.
+ if (!parts->scheme.is_valid())
+ scheme.assign(StartsWith(text, L"ftp.", false) ? L"ftp" : L"http");
// Cannonicalize the scheme.
StringToLowerASCII(&scheme);