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

Side by Side Diff: net/http/http_response_body_drainer.cc

Issue 11112021: Treat 0 returned from HttpStream::ReadResponseBody correctly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/http/http_response_body_drainer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_response_body_drainer.h" 5 #include "net/http/http_response_body_drainer.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 base::Bind(&HttpResponseBodyDrainer::OnIOComplete, 91 base::Bind(&HttpResponseBodyDrainer::OnIOComplete,
92 base::Unretained(this))); 92 base::Unretained(this)));
93 } 93 }
94 94
95 int HttpResponseBodyDrainer::DoDrainResponseBodyComplete(int result) { 95 int HttpResponseBodyDrainer::DoDrainResponseBodyComplete(int result) {
96 DCHECK_NE(ERR_IO_PENDING, result); 96 DCHECK_NE(ERR_IO_PENDING, result);
97 97
98 if (result < 0) 98 if (result < 0)
99 return result; 99 return result;
100 100
101 if (result == 0)
102 return ERR_CONNECTION_CLOSED;
103
104 total_read_ += result; 101 total_read_ += result;
105 if (stream_->IsResponseBodyComplete()) 102 if (stream_->IsResponseBodyComplete())
106 return OK; 103 return OK;
107 104
108 DCHECK_LE(total_read_, kDrainBodyBufferSize); 105 DCHECK_LE(total_read_, kDrainBodyBufferSize);
109 if (total_read_ >= kDrainBodyBufferSize) 106 if (total_read_ >= kDrainBodyBufferSize)
110 return ERR_RESPONSE_BODY_TOO_BIG_TO_DRAIN; 107 return ERR_RESPONSE_BODY_TOO_BIG_TO_DRAIN;
111 108
112 next_state_ = STATE_DRAIN_RESPONSE_BODY; 109 next_state_ = STATE_DRAIN_RESPONSE_BODY;
113 return OK; 110 return OK;
(...skipping 21 matching lines...) Expand all
135 stream_->Close(true /* no keep-alive */); 132 stream_->Close(true /* no keep-alive */);
136 } else { 133 } else {
137 DCHECK_EQ(OK, result); 134 DCHECK_EQ(OK, result);
138 stream_->Close(false /* keep-alive */); 135 stream_->Close(false /* keep-alive */);
139 } 136 }
140 137
141 delete this; 138 delete this;
142 } 139 }
143 140
144 } // namespace net 141 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_response_body_drainer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698