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

Unified Diff: net/http/http_stream_parser.cc

Issue 2030353002: UploadDataStream now returns errors on failures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed issues and combined with HttpStreamParser cl due to dependencies Created 4 years, 6 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
Index: net/http/http_stream_parser.cc
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc
index c6b87e26a21984dd0450e597e44be31906904a6f..57ef06a34ad38ab6e533d555ddef86212cde8d8e 100644
--- a/net/http/http_stream_parser.cc
+++ b/net/http/http_stream_parser.cc
@@ -295,7 +295,8 @@ 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.
+ // Read() must succeed synchronously if not chunked and in memory.
+ DCHECK_GT(consumed, 0);
request_headers_->DidConsume(consumed);
todo -= consumed;
}
@@ -550,7 +551,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()) {

Powered by Google App Engine
This is Rietveld 408576698