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() { |