SPDY - Handle incomplete headers during server push.
If we receive a data frame without a status or without
a version header, we close the stream with a PROTOCOL ERROR.
Small bug fix to HttpNetworkTransaction to access the
ResponseHeaders only if headers are there.
In SpdyStream, retrun a SPDY_PROTOCOL_ERROR if we have pending
data frames, but we haven't received "status" and "version"
headers. (rch: removed the DCHECK for unit tests).
SpdyHttpStream's OnDataReceived used to expect that it would
be called only when all required headers are received. Converted
the DCHECK into an error condition and SpdyStream closes the
stream with PROTOCOL ERROR if OnDataReceived returns a network
error.
BUG=135485
[email protected]
TEST=network unittests
Review URL: https://chromiumcodereview.appspot.com/10836084
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150121 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 51b5a6e..e825fb2e 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -920,8 +920,13 @@
// TODO(mbelshe): The keepalive property is really a property of
// the stream. No need to compute it here just to pass back
// to the stream's Close function.
- if (stream_->CanFindEndOfResponse())
- keep_alive = GetResponseHeaders()->IsKeepAlive();
+ // TODO(rtenneti): CanFindEndOfResponse should return false if there are no
+ // ResponseHeaders.
+ if (stream_->CanFindEndOfResponse()) {
+ HttpResponseHeaders* headers = GetResponseHeaders();
+ if (headers)
+ keep_alive = headers->IsKeepAlive();
+ }
}
// Clean up connection if we are done.