Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Unified Diff: webkit/glue/multipart_response_delegate.cc

Issue 2787002: Take 2 at working around a multipart crash (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: style Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webkit/glue/multipart_response_delegate_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/multipart_response_delegate.cc
diff --git a/webkit/glue/multipart_response_delegate.cc b/webkit/glue/multipart_response_delegate.cc
index 8de6469fb584036d703e489df7745e3450a31fd2..1b68064831a96f3313bc065e548f8d05c962285b 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() {
« no previous file with comments | « no previous file | webkit/glue/multipart_response_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698