Index: url/url_parse_internal.h |
diff --git a/url/url_parse_internal.h b/url/url_parse_internal.h |
index 9c2b2b6889a93d50ad4a4e2f2a5473c42361c61a..e61379ceb1bb8e949fc7428cdacff2908b7d1302 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 |