summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/http/http_response_headers.cc9
-rw-r--r--net/http/http_response_headers_unittest.cc8
2 files changed, 14 insertions, 3 deletions
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc
index 4038aff..81d2ceb 100644
--- a/net/http/http_response_headers.cc
+++ b/net/http/http_response_headers.cc
@@ -1000,8 +1000,13 @@ bool HttpResponseHeaders::GetContentRange(int64* first_byte_position,
return false;
// Invalid header if it doesn't contain "bytes-unit".
- if (!LowerCaseEqualsASCII(content_range_spec.begin(),
- content_range_spec.begin() + space_position,
+ std::string::const_iterator content_range_spec_begin =
+ content_range_spec.begin();
+ std::string::const_iterator content_range_spec_end =
+ content_range_spec.begin() + space_position;
+ HttpUtil::TrimLWS(&content_range_spec_begin, &content_range_spec_end);
+ if (!LowerCaseEqualsASCII(content_range_spec_begin,
+ content_range_spec_end,
"bytes")) {
return false;
}
diff --git a/net/http/http_response_headers_unittest.cc b/net/http/http_response_headers_unittest.cc
index c78c597..da18f11 100644
--- a/net/http/http_response_headers_unittest.cc
+++ b/net/http/http_response_headers_unittest.cc
@@ -1136,7 +1136,13 @@ TEST(HttpResponseHeaders, GetContentRange) {
50,
51
},
-
+ { "HTTP/1.1 206 Partial Content\n"
+ "Content-Range: \tbytes\t\t\t 0\t-\t50\t/\t51\t",
+ true,
+ 0,
+ 50,
+ 51
+ },
{ "HTTP/1.1 206 Partial Content\n"
"Content-Range: \t bytes \t 0 - 50 / 5 1",
false,