summaryrefslogtreecommitdiffstats
path: root/webkit/glue/multipart_response_delegate.cc
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-06 00:04:01 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-06 00:04:01 +0000
commitd0759395d231633ac65dc89c580373d7176e0661 (patch)
tree51cba672036b2709cb6622701dafbb592c7dcaab /webkit/glue/multipart_response_delegate.cc
parent5b10348cf8be7f63bc2a57ee1caeacfd4a5b97e0 (diff)
downloadchromium_src-d0759395d231633ac65dc89c580373d7176e0661.zip
chromium_src-d0759395d231633ac65dc89c580373d7176e0661.tar.gz
chromium_src-d0759395d231633ac65dc89c580373d7176e0661.tar.bz2
This fixes bug http://code.google.com/p/chromium/issues/detail?id=4076, which was a hang while loading certain PDF files. This was a regression caused by support for NPN_RequestRead (PDF Fast Webview). We had incorrectly assumed that the Content Type showing up for partial HTTP Responses would always end with the boundary. A content type can show up like multipart/byteranges; boundary=--bound--; charSet=utf8. As a result we would look for the wrong boundary in the actual data resulting in a hang.
The parsing code now accounts for this. Added a unit test to test this case. Bug=4076 R=jam Review URL: http://codereview.chromium.org/9198 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4842 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/multipart_response_delegate.cc')
-rw-r--r--webkit/glue/multipart_response_delegate.cc7
1 files changed, 6 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;