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

Unified Diff: net/http/http_stream_parser.cc

Issue 2130733003: [HttpStreamParser]: Flush buffers as soon as request is sent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « net/http/http_stream_parser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « net/http/http_stream_parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698