diff options
-rw-r--r-- | webkit/glue/multipart_response_delegate.cc | 5 | ||||
-rw-r--r-- | webkit/glue/multipart_response_delegate_unittest.cc | 14 |
2 files changed, 18 insertions, 1 deletions
diff --git a/webkit/glue/multipart_response_delegate.cc b/webkit/glue/multipart_response_delegate.cc index 2c2b2b3..82e73e2 100644 --- a/webkit/glue/multipart_response_delegate.cc +++ b/webkit/glue/multipart_response_delegate.cc @@ -236,7 +236,6 @@ size_t MultipartResponseDelegate::FindBoundary() { bool MultipartResponseDelegate::ReadMultipartBoundary( const WebCore::ResourceResponse& response, std::string* multipart_boundary) { - WebCore::String content_type = response.httpHeaderField("Content-Type"); std::string content_type_as_string = webkit_glue::StringToStdString(content_type); @@ -258,6 +257,10 @@ bool MultipartResponseDelegate::ReadMultipartBoundary( *multipart_boundary = content_type_as_string.substr(boundary_start_offset, boundary_length); + // The byte range response can have quoted boundary strings. This is legal + // as per MIME specifications. Individual data fragements however don't + // contain quoted boundary strings. + TrimString(*multipart_boundary, "\"", multipart_boundary); return true; } diff --git a/webkit/glue/multipart_response_delegate_unittest.cc b/webkit/glue/multipart_response_delegate_unittest.cc index efe1a6e..e7d020c 100644 --- a/webkit/glue/multipart_response_delegate_unittest.cc +++ b/webkit/glue/multipart_response_delegate_unittest.cc @@ -439,6 +439,20 @@ TEST(MultipartResponseTest, MultipartByteRangeParsingTest) { response4, &multipart_boundary); EXPECT_EQ(result, true); EXPECT_EQ(string("--bound--"), multipart_boundary); + + ResourceResponse response5(KURL(), "multipart/byteranges", 0, "en-US", + String()); + response5.setHTTPHeaderField(String("Content-Length"), String("200")); + response5.setHTTPHeaderField( + String("Content-type"), + String("multipart/byteranges; boundary=\"--bound--\"; charSet=utf8")); + + multipart_boundary.clear(); + + result = MultipartResponseDelegate::ReadMultipartBoundary( + response5, &multipart_boundary); + EXPECT_EQ(result, true); + EXPECT_EQ(string("--bound--"), multipart_boundary); } TEST(MultipartResponseTest, MultipartContentRangesTest) { |