diff options
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 |