Index: net/http/http_stream_parser.cc |
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc |
index 57ef06a34ad38ab6e533d555ddef86212cde8d8e..e26566b32a9bd0ceb7218e32cb9d2e0e6cac2ef7 100644 |
--- a/net/http/http_stream_parser.cc |
+++ b/net/http/http_stream_parser.cc |
@@ -506,6 +506,7 @@ int HttpStreamParser::DoSendHeadersComplete(int result) { |
} |
// Finished sending the request. |
+ FlushBuffers(); |
return OK; |
} |
@@ -520,6 +521,7 @@ int HttpStreamParser::DoSendBody() { |
if (request_->upload_data_stream->is_chunked() && sent_last_chunk_) { |
// Finished sending the request. |
+ FlushBuffers(); |
return OK; |
} |
@@ -551,8 +553,10 @@ int HttpStreamParser::DoSendBodyComplete(int result) { |
int HttpStreamParser::DoSendRequestReadBodyComplete(int result) { |
// |result| is the result of read from the request body from the last call to |
// DoSendBody(). |
- if (result < 0) |
+ if (result < 0) { |
+ FlushBuffers(); |
return result; |
+ } |
// Chunked data needs to be encoded. |
if (request_->upload_data_stream->is_chunked()) { |
@@ -574,6 +578,7 @@ int HttpStreamParser::DoSendRequestReadBodyComplete(int result) { |
DCHECK(request_->upload_data_stream->IsEOF()); |
DCHECK(!request_->upload_data_stream->is_chunked()); |
// Finished sending the request. |
+ FlushBuffers(); |
} else if (result > 0) { |
request_body_send_buf_->DidAppend(result); |
result = 0; |
@@ -1188,4 +1193,13 @@ void HttpStreamParser::ValidateStatusLine(const std::string& status_line) { |
HttpStatusLineValidator::STATUS_LINE_MAX); |
} |
+void HttpStreamParser::FlushBuffers() { |
+ if (request_headers_) |
mmenke
2016/07/11 15:15:35
None of these ifs are necessary - refptrs have ide
|
+ request_headers_ = nullptr; |
+ if (request_body_send_buf_) |
+ request_body_send_buf_ = nullptr; |
+ if (request_body_read_buf_) |
+ request_body_read_buf_ = nullptr; |
+} |
+ |
} // namespace net |