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

Unified Diff: net/http/http_stream_parser.cc

Issue 2007013003: Introduce error handling in HttpStreamParser on UploadDataStream::Read() failure. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | net/http/http_stream_parser_unittest.cc » ('j') | net/http/http_stream_parser_unittest.cc » ('J')
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 c718761ec7856dd132f14cfb211b977d58b7ed38..eeebdb9d215c3d2dc608d3133acd2fae8cb9534f 100644
--- a/net/http/http_stream_parser.cc
+++ b/net/http/http_stream_parser.cc
@@ -273,7 +273,6 @@ int HttpStreamParser::SendRequest(const std::string& request_line,
}
io_state_ = STATE_SEND_HEADERS;
-
// If we have a small request body, then we'll merge with the headers into a
// single write.
bool did_merge = false;
@@ -286,7 +285,6 @@ int HttpStreamParser::SendRequest(const std::string& request_line,
// body.
request_headers_ = new DrainableIOBuffer(
merged_request_headers_and_body.get(), merged_size);
-
memcpy(request_headers_->data(), request.data(), request_headers_length_);
request_headers_->DidConsume(request_headers_length_);
@@ -294,7 +292,7 @@ int HttpStreamParser::SendRequest(const std::string& request_line,
while (todo) {
int consumed = request_->upload_data_stream->Read(
request_headers_.get(), static_cast<int>(todo), CompletionCallback());
- DCHECK_GT(consumed, 0); // Read() won't fail if not chunked.
+ DCHECK_GT(consumed, 0);
mmenke 2016/05/25 15:13:31 You removed a comment here. Please bring it back.
maksims (do not use this acc) 2016/05/26 08:54:41 Done.
request_headers_->DidConsume(consumed);
todo -= consumed;
}
@@ -549,7 +547,8 @@ 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().
- DCHECK_GE(result, 0); // There won't be errors.
+ if (result < 0)
+ return result;
// Chunked data needs to be encoded.
if (request_->upload_data_stream->is_chunked()) {
« no previous file with comments | « no previous file | net/http/http_stream_parser_unittest.cc » ('j') | net/http/http_stream_parser_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698