summaryrefslogtreecommitdiffstats
path: root/webkit/glue/multipart_response_delegate.cc
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-19 00:03:27 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-19 00:03:27 +0000
commit81bf98ca3a0aa32be3902a22b63f0a5b17a18ff6 (patch)
tree676e4f035f15df97d0f0ca415ad084b41d68657e /webkit/glue/multipart_response_delegate.cc
parente78587b20548184b15b5cfda805b2eaf12879c0b (diff)
downloadchromium_src-81bf98ca3a0aa32be3902a22b63f0a5b17a18ff6.zip
chromium_src-81bf98ca3a0aa32be3902a22b63f0a5b17a18ff6.tar.gz
chromium_src-81bf98ca3a0aa32be3902a22b63f0a5b17a18ff6.tar.bz2
Work around a multipart crash caused by sending
a response header immediately after sending data. The work around is to be more aggressive about sending multipart data before we have a response header. We used to buffer a response until we had the full frame. This avoids a crash in webcore by behaving more like CFNetwork. It also makes us behave more like Gecko, which is probably good for compat. BUG=30880 Review URL: http://codereview.chromium.org/2070007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47599 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/multipart_response_delegate.cc')
-rw-r--r--webkit/glue/multipart_response_delegate.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/webkit/glue/multipart_response_delegate.cc b/webkit/glue/multipart_response_delegate.cc
index 8de6469..1b68064 100644
--- a/webkit/glue/multipart_response_delegate.cc
+++ b/webkit/glue/multipart_response_delegate.cc
@@ -149,6 +149,18 @@ void MultipartResponseDelegate::OnReceivedData(const char* data,
break;
}
}
+
+ // At this point, we should send over any data we have, but keep enough data
+ // buffered to handle a boundary that may have been truncated.
+ if (!processing_headers_ && data_.length() > boundary_.length()) {
+ // If the last character is a new line character, go ahead and just send
+ // everything we have buffered. This matches an optimization in Gecko.
+ int send_length = data_.length() - boundary_.length();
+ if (data_[data_.length() - 1] == '\n')
+ send_length = data_.length();
+ client_->didReceiveData(loader_, data_.data(), send_length);
+ data_ = data_.substr(send_length);
+ }
}
void MultipartResponseDelegate::OnCompletedRequest() {