Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Unified Diff: src/url_util.cc

Issue 1558030: Canonicalize URL before using Extractscheme in DoFindAndCompareScheme functio... (Closed) Base URL: http://google-url.googlecode.com/svn/trunk/
Patch Set: '' Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/url_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/url_util.cc
===================================================================
--- src/url_util.cc (revision 127)
+++ src/url_util.cc (working copy)
@@ -118,8 +118,15 @@
int str_len,
const char* compare,
url_parse::Component* found_scheme) {
+ // Before extracting scheme, canonicalize the URL to remove any whitespace.
+ // This matches the canonicalization done in DoCanonicalize function.
+ url_canon::RawCanonOutputT<CHAR> whitespace_buffer;
+ int spec_len;
+ const CHAR* spec = RemoveURLWhitespace(str, str_len,
+ &whitespace_buffer, &spec_len);
+
url_parse::Component our_scheme;
- if (!url_parse::ExtractScheme(str, str_len, &our_scheme)) {
+ if (!url_parse::ExtractScheme(spec, spec_len, &our_scheme)) {
// No scheme.
if (found_scheme)
*found_scheme = url_parse::Component();
@@ -127,7 +134,7 @@
}
if (found_scheme)
*found_scheme = our_scheme;
- return CompareSchemeComponent(str, our_scheme, compare);
+ return CompareSchemeComponent(spec, our_scheme, compare);
}
template<typename CHAR>
« no previous file with comments | « no previous file | src/url_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698