diff options
author | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-23 01:53:52 +0000 |
---|---|---|
committer | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-23 01:53:52 +0000 |
commit | 369e84f70d256d188a1866d8cef52edf4468cd9b (patch) | |
tree | e7e90408125f4831ce7983fd37414ad763b965b1 /url/url_parse_internal.h | |
parent | a7e3691579181327dc65b02d043e7c01d4b06cb9 (diff) | |
download | chromium_src-369e84f70d256d188a1866d8cef52edf4468cd9b.zip chromium_src-369e84f70d256d188a1866d8cef52edf4468cd9b.tar.gz chromium_src-369e84f70d256d188a1866d8cef52edf4468cd9b.tar.bz2 |
Support URL fragment resolution against non-hierarchical schemes
Support URL fragment resolution against non-hierarchical schemes
As a result, data: about: etc now have 'query' and 'ref' components
parsed; as a result a new GURL::GetContent() convenience is added to
retrieve the spec with the scheme stripped off.
A complication in supporting this is that we now need to allow whitespace
to trailing whitespace to be preserved when transferring url_parse::Parsed
structs between KURL and GURL. Without this, the URL prior to the
#fragment can change (i.e. whitespace stripped) when following an anchor
link which breaks the page (causes reload from source). See
http://crbug.com/291747 for more details on this.
R=brettw@chromium.org
TBR=cbentzel@chromium.org
BUG=291747
Review URL: https://codereview.chromium.org/23835019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236917 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'url/url_parse_internal.h')
-rw-r--r-- | url/url_parse_internal.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/url/url_parse_internal.h b/url/url_parse_internal.h index 9c2b2b6..e61379c 100644 --- a/url/url_parse_internal.h +++ b/url/url_parse_internal.h @@ -28,15 +28,19 @@ inline bool ShouldTrimFromURL(base::char16 ch) { // in the input string (so the string starts at character |*begin| in the spec, // and goes until |*len|). template<typename CHAR> -inline void TrimURL(const CHAR* spec, int* begin, int* len) { +inline void TrimURL(const CHAR* spec, int* begin, int* len, + bool trim_path_end = true) { // Strip leading whitespace and control characters. while (*begin < *len && ShouldTrimFromURL(spec[*begin])) (*begin)++; - // Strip trailing whitespace and control characters. We need the >i test for - // when the input string is all blanks; we don't want to back past the input. - while (*len > *begin && ShouldTrimFromURL(spec[*len - 1])) - (*len)--; + if (trim_path_end) { + // Strip trailing whitespace and control characters. We need the >i test + // for when the input string is all blanks; we don't want to back past the + // input. + while (*len > *begin && ShouldTrimFromURL(spec[*len - 1])) + (*len)--; + } } // Counts the number of consecutive slashes starting at the given offset |