summaryrefslogtreecommitdiffstats
path: root/net/http/http_stream_parser.cc
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-08 21:28:14 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-08 21:28:14 +0000
commit02c92c499441303f58312463b30deb53f02dba63 (patch)
tree26c3cae25835fe74e176c625c67333106ec780f6 /net/http/http_stream_parser.cc
parent4bf413576fa9c6e19a16119b007112f7a32c6ffc (diff)
downloadchromium_src-02c92c499441303f58312463b30deb53f02dba63.zip
chromium_src-02c92c499441303f58312463b30deb53f02dba63.tar.gz
chromium_src-02c92c499441303f58312463b30deb53f02dba63.tar.bz2
Use 0 for successful end of stream.
BUG=25032 TEST=none Review URL: http://codereview.chromium.org/669122 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40938 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_stream_parser.cc')
-rw-r--r--net/http/http_stream_parser.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc
index 0a635f5..446c8ed 100644
--- a/net/http/http_stream_parser.cc
+++ b/net/http/http_stream_parser.cc
@@ -353,7 +353,7 @@ int HttpStreamParser::DoReadBody() {
// Check to see if we're done reading.
if (IsResponseBodyComplete())
- return ERR_END_OF_STREAM;
+ return 0;
DCHECK_EQ(0, read_buf_->offset());
return connection_->socket()->Read(user_read_buf_, user_read_buf_len_,
@@ -361,7 +361,11 @@ int HttpStreamParser::DoReadBody() {
}
int HttpStreamParser::DoReadBodyComplete(int result) {
- if (result == 0)
+ // If we didn't get a content-length and aren't using a chunked encoding,
+ // the only way to signal the end of a stream is to close the connection,
+ // so we don't treat that as an error, though in some cases we may not
+ // have completely received the resource.
+ if (result == 0 && !IsResponseBodyComplete() && CanFindEndOfResponse())
result = ERR_CONNECTION_CLOSED;
// Filter incoming data if appropriate. FilterBuf may return an error.
@@ -378,7 +382,7 @@ int HttpStreamParser::DoReadBodyComplete(int result) {
if (result > 0)
response_body_read_ += result;
- if (result < 0 || IsResponseBodyComplete()) {
+ if (result <= 0 || IsResponseBodyComplete()) {
io_state_ = STATE_DONE;
// Save the overflow data, which can be in two places. There may be