summaryrefslogtreecommitdiffstats
path: root/net/spdy/spdy_http_stream.cc
diff options
context:
space:
mode:
authormbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-03 22:04:03 +0000
committermbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-03 22:04:03 +0000
commitd083585002893abaa6172c361aa04306a0e4d396 (patch)
tree75ff77ddf51d68d450ee0e7d56192409e44bcf97 /net/spdy/spdy_http_stream.cc
parent95c97199c4406036b216d74e4ba3a5c57c0081a2 (diff)
downloadchromium_src-d083585002893abaa6172c361aa04306a0e4d396.zip
chromium_src-d083585002893abaa6172c361aa04306a0e4d396.tar.gz
chromium_src-d083585002893abaa6172c361aa04306a0e4d396.tar.bz2
Update server push to allow use of HEADERS frame.
- Sync'd server changes for SPDY protocol and framer. - Adds HEADERS support & smaller header frame support. - Changes field name from "path" to "url" for pushed streams. - Changes existing semantics in SpdyStream and SpdyHttpStream with how the OnResponseReceived callback works and with how headers are parsed to reflect multi-frame arrival of headers. Other changes: - Reworked the StaticSocketDataProvider interface slightly so that we can share code between tests using DelayedSocketData or DeterministicSocketData - Tidy up net_log for pushed streams with associated-stream id logging and format fixes for SPDY_STREAM. BUG=none TEST=spdy_framer_test,spdy_network_transaction_unittest(s) Review URL: http://codereview.chromium.org/5248001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68221 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_http_stream.cc')
-rw-r--r--net/spdy/spdy_http_stream.cc33
1 files changed, 23 insertions, 10 deletions
diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc
index 286d557..fedadd7 100644
--- a/net/spdy/spdy_http_stream.cc
+++ b/net/spdy/spdy_http_stream.cc
@@ -27,6 +27,7 @@ SpdyHttpStream::SpdyHttpStream(SpdySession* spdy_session, bool direct)
spdy_session_(spdy_session),
response_info_(NULL),
download_finished_(false),
+ response_headers_received_(false),
user_callback_(NULL),
user_buffer_len_(0),
buffered_read_callback_pending_(false),
@@ -242,29 +243,41 @@ int SpdyHttpStream::OnResponseReceived(const spdy::SpdyHeaderBlock& response,
response_info_ = push_response_info_.get();
}
+ // If the response is already received, these headers are too late.
+ if (response_headers_received_) {
+ LOG(WARNING) << "SpdyHttpStream headers received after response started.";
+ return OK;
+ }
+
// TODO(mbelshe): This is the time of all headers received, not just time
// to first byte.
- DCHECK(response_info_->response_time.is_null());
response_info_->response_time = base::Time::Now();
if (!SpdyHeadersToHttpResponse(response, response_info_)) {
- status = ERR_INVALID_RESPONSE;
- } else {
- stream_->GetSSLInfo(&response_info_->ssl_info,
- &response_info_->was_npn_negotiated);
- response_info_->request_time = stream_->GetRequestTime();
- response_info_->vary_data.Init(*request_info_, *response_info_->headers);
- // TODO(ahendrickson): This is recorded after the entire SYN_STREAM control
- // frame has been received and processed. Move to framer?
- response_info_->response_time = response_time;
+ // We might not have complete headers yet.
+ return ERR_INCOMPLETE_SPDY_HEADERS;
}
+ response_headers_received_ = true;
+ stream_->GetSSLInfo(&response_info_->ssl_info,
+ &response_info_->was_npn_negotiated);
+ response_info_->request_time = stream_->GetRequestTime();
+ response_info_->vary_data.Init(*request_info_, *response_info_->headers);
+ // TODO(ahendrickson): This is recorded after the entire SYN_STREAM control
+ // frame has been received and processed. Move to framer?
+ response_info_->response_time = response_time;
+
if (user_callback_)
DoCallback(status);
return status;
}
void SpdyHttpStream::OnDataReceived(const char* data, int length) {
+ // SpdyStream won't call us with data if the header block didn't contain a
+ // valid set of headers. So we don't expect to not have headers received
+ // here.
+ DCHECK(response_headers_received_);
+
// Note that data may be received for a SpdyStream prior to the user calling
// ReadResponseBody(), therefore user_buffer_ may be NULL. This may often
// happen for server initiated streams.