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-01-07 01:42:38 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-07 01:42:38 +0000
commitee9410e7f9f920f30269a806d9aa2a3e403b49a4 (patch)
tree7b12f3b2539330c41dc998d198bcc5e88bf5ecbd /net/http/http_stream_parser.cc
parent1916c65b2f88e95efc11fea6e553923f192849ff (diff)
downloadchromium_src-ee9410e7f9f920f30269a806d9aa2a3e403b49a4.zip
chromium_src-ee9410e7f9f920f30269a806d9aa2a3e403b49a4.tar.gz
chromium_src-ee9410e7f9f920f30269a806d9aa2a3e403b49a4.tar.bz2
A 1xx response code followed by an EOF triggered an infinite loop. Fix the problem and add a regression test.
BUG=31324 TEST=new net unittest Review URL: http://codereview.chromium.org/523075 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35680 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_stream_parser.cc')
-rw-r--r--net/http/http_stream_parser.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc
index a83616b..abbf112 100644
--- a/net/http/http_stream_parser.cc
+++ b/net/http/http_stream_parser.cc
@@ -62,10 +62,15 @@ int HttpStreamParser::SendRequest(const HttpRequestInfo* request,
}
int HttpStreamParser::ReadResponseHeaders(CompletionCallback* callback) {
- DCHECK_EQ(STATE_REQUEST_SENT, io_state_);
+ DCHECK(io_state_ == STATE_REQUEST_SENT || io_state_ == STATE_DONE);
DCHECK(!user_callback_);
DCHECK(callback);
+ // This function can be called with io_state_ == STATE_DONE if the
+ // connection is closed after seeing just a 1xx response code.
+ if (io_state_ == STATE_DONE)
+ return ERR_CONNECTION_CLOSED;
+
int result = OK;
io_state_ = STATE_READ_HEADERS;