summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--webkit/glue/multipart_response_delegate.cc12
-rw-r--r--webkit/glue/multipart_response_delegate_unittest.cc22
2 files changed, 11 insertions, 23 deletions
diff --git a/webkit/glue/multipart_response_delegate.cc b/webkit/glue/multipart_response_delegate.cc
index 1b68064..8de6469 100644
--- a/webkit/glue/multipart_response_delegate.cc
+++ b/webkit/glue/multipart_response_delegate.cc
@@ -149,18 +149,6 @@ 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() {
diff --git a/webkit/glue/multipart_response_delegate_unittest.cc b/webkit/glue/multipart_response_delegate_unittest.cc
index 84d1e05..7e3cc32 100644
--- a/webkit/glue/multipart_response_delegate_unittest.cc
+++ b/webkit/glue/multipart_response_delegate_unittest.cc
@@ -237,8 +237,8 @@ TEST(MultipartResponseTest, MissingBoundaries) {
delegate2.OnReceivedData(no_end_boundary.c_str(),
static_cast<int>(no_end_boundary.length()));
EXPECT_EQ(1, client.received_response_);
- EXPECT_EQ(1, client.received_data_);
- EXPECT_EQ("This is a sample response\n", client.data_);
+ EXPECT_EQ(0, client.received_data_);
+ EXPECT_EQ(string(), client.data_);
delegate2.OnCompletedRequest();
EXPECT_EQ(1, client.received_response_);
@@ -255,8 +255,8 @@ TEST(MultipartResponseTest, MissingBoundaries) {
delegate3.OnReceivedData(no_boundaries.c_str(),
static_cast<int>(no_boundaries.length()));
EXPECT_EQ(1, client.received_response_);
- EXPECT_EQ(1, client.received_data_);
- EXPECT_EQ("This is a sample response\n", client.data_);
+ EXPECT_EQ(0, client.received_data_);
+ EXPECT_EQ(string(), client.data_);
delegate3.OnCompletedRequest();
EXPECT_EQ(1, client.received_response_);
@@ -355,20 +355,20 @@ TEST(MultipartResponseTest, BreakInBoundary) {
// Break in first and second
const TestChunk bound2[] = {
{ 0, 4, 0, 0, ""},
- { 4, 55, 1, 1, "datadatadatadat" },
- { 55, 65, 1, 2, "datadatadatadatadata" },
- { 65, 110, 2, 3, "foofoofoofoofoo" },
+ { 4, 55, 1, 0, "" },
+ { 55, 65, 1, 1, "datadatadatadatadata" },
+ { 65, 110, 2, 2, "foofoofoofoofoo" },
};
VariousChunkSizesTest(bound2, arraysize(bound2),
- 2, 3, "foofoofoofoofoo");
+ 2, 2, "foofoofoofoofoo");
// Break in second only
const TestChunk bound3[] = {
- { 0, 55, 1, 1, "datadatadatadat" },
- { 55, 110, 2, 3, "foofoofoofoofoo" },
+ { 0, 55, 1, 0, "" },
+ { 55, 110, 2, 2, "foofoofoofoofoo" },
};
VariousChunkSizesTest(bound3, arraysize(bound3),
- 2, 3, "foofoofoofoofoo");
+ 2, 2, "foofoofoofoofoo");
}
TEST(MultipartResponseTest, BreakInHeaders) {