diff options
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/multipart_response_delegate.cc | 7 | ||||
-rw-r--r-- | webkit/glue/multipart_response_delegate_unittest.cc | 14 |
2 files changed, 20 insertions, 1 deletions
diff --git a/webkit/glue/multipart_response_delegate.cc b/webkit/glue/multipart_response_delegate.cc index 72d4158..2c2b2b3 100644 --- a/webkit/glue/multipart_response_delegate.cc +++ b/webkit/glue/multipart_response_delegate.cc @@ -247,7 +247,12 @@ bool MultipartResponseDelegate::ReadMultipartBoundary( } boundary_start_offset += strlen("boundary="); - size_t boundary_end_offset = content_type.length(); + + size_t boundary_end_offset = + content_type_as_string.find(';', boundary_start_offset); + + if (boundary_end_offset == std::string::npos) + boundary_end_offset = content_type_as_string.length(); size_t boundary_length = boundary_end_offset - boundary_start_offset; diff --git a/webkit/glue/multipart_response_delegate_unittest.cc b/webkit/glue/multipart_response_delegate_unittest.cc index 93bfcb2..efe1a6e 100644 --- a/webkit/glue/multipart_response_delegate_unittest.cc +++ b/webkit/glue/multipart_response_delegate_unittest.cc @@ -425,6 +425,20 @@ TEST(MultipartResponseTest, MultipartByteRangeParsingTest) { response3, &multipart_boundary); EXPECT_EQ(result, false); EXPECT_EQ(multipart_boundary.length(), 0U); + + ResourceResponse response4(KURL(), "multipart/byteranges", 0, "en-US", + String()); + response4.setHTTPHeaderField(String("Content-Length"), String("200")); + response4.setHTTPHeaderField( + String("Content-type"), + String("multipart/byteranges; boundary=--bound--; charSet=utf8")); + + multipart_boundary.clear(); + + result = MultipartResponseDelegate::ReadMultipartBoundary( + response4, &multipart_boundary); + EXPECT_EQ(result, true); + EXPECT_EQ(string("--bound--"), multipart_boundary); } TEST(MultipartResponseTest, MultipartContentRangesTest) { |