summaryrefslogtreecommitdiffstats
path: root/net/spdy/spdy_stream.cc
diff options
context:
space:
mode:
authorahendrickson@google.com <ahendrickson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-25 19:56:12 +0000
committerahendrickson@google.com <ahendrickson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-25 19:56:12 +0000
commit3f662f158a7ba94d3e1b235262a975474c117fad (patch)
treefbb8952a875ab16c3a6e766257548084e33aae9f /net/spdy/spdy_stream.cc
parent8bb174c2d00c18fb682ab9bcbfa1f5f3f0ed2281 (diff)
downloadchromium_src-3f662f158a7ba94d3e1b235262a975474c117fad.zip
chromium_src-3f662f158a7ba94d3e1b235262a975474c117fad.tar.gz
chromium_src-3f662f158a7ba94d3e1b235262a975474c117fad.tar.bz2
SpdySession now sets the following fields in HttpResponseInfo:
request_time response_time vary_data There is also a unit test to exercise the new functionality. - Changed CreateSpdyHeadersFromHttpRequest() to use std::string::append() rather than std::string::operator+() to append a single '\0' character to the string, as the former does nothing. - Now using SpdyFramer. - The unit tests now include all server push cases. BUG=34505 TEST=Run netunittests.exe --gtest_filter=SpdyNetworkTransactionTest.* Review URL: http://codereview.chromium.org/634002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42660 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_stream.cc')
-rw-r--r--net/spdy/spdy_stream.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc
index 6b82fa1..c381da1 100644
--- a/net/spdy/spdy_stream.cc
+++ b/net/spdy/spdy_stream.cc
@@ -20,6 +20,7 @@ SpdyStream::SpdyStream(SpdySession* session, spdy::SpdyStreamId stream_id,
download_finished_(false),
metrics_(Singleton<BandwidthMetrics>::get()),
session_(session),
+ request_time_(base::Time::Now()),
response_(NULL),
request_body_stream_(NULL),
response_complete_(false),
@@ -59,6 +60,28 @@ const HttpResponseInfo* SpdyStream::GetResponseInfo() const {
return response_;
}
+const HttpRequestInfo* SpdyStream::GetRequestInfo() const {
+ return &request_;
+}
+
+void SpdyStream::SetRequestInfo(const HttpRequestInfo& request) {
+ request_ = request;
+}
+
+base::Time SpdyStream::GetRequestTime() const {
+ return request_time_;
+}
+
+void SpdyStream::SetRequestTime(base::Time t) {
+ request_time_ = t;
+
+ // This should only get called in the case of a request occuring
+ // during server push that has already begun but hasn't finished,
+ // so we set the response's request time to be the actual one
+ if (response_)
+ response_->request_time = request_time_;
+}
+
int SpdyStream::ReadResponseHeaders(CompletionCallback* callback) {
// Note: The SpdyStream may have already received the response headers, so
// this call may complete synchronously.
@@ -128,6 +151,8 @@ int SpdyStream::SendRequest(UploadDataStream* upload_data,
CHECK(!cancelled_);
CHECK(response);
+ DLOG(INFO) << " * " << __FUNCTION__ << "()";
+
if (response_) {
*response = *response_;
delete response_;
@@ -169,6 +194,7 @@ void SpdyStream::Cancel() {
}
void SpdyStream::OnResponseReceived(const HttpResponseInfo& response) {
+ DLOG(INFO) << " >> " << __FUNCTION__ << "()";
metrics_.StartStream();
CHECK(!response_->headers);
@@ -200,6 +226,7 @@ void SpdyStream::OnResponseReceived(const HttpResponseInfo& response) {
}
bool SpdyStream::OnDataReceived(const char* data, int length) {
+ DLOG(INFO) << " >> " << __FUNCTION__ << "()";
DCHECK_GE(length, 0);
LOG(INFO) << "SpdyStream: Data (" << length << " bytes) received for "
<< stream_id_;
@@ -250,6 +277,7 @@ bool SpdyStream::OnDataReceived(const char* data, int length) {
}
void SpdyStream::OnWriteComplete(int status) {
+ DLOG(INFO) << " >> " << __FUNCTION__ << "()";
// TODO(mbelshe): Check for cancellation here. If we're cancelled, we
// should discontinue the DoLoop.
@@ -260,6 +288,7 @@ void SpdyStream::OnWriteComplete(int status) {
}
void SpdyStream::OnClose(int status) {
+ DLOG(INFO) << " >> " << __FUNCTION__ << "()";
response_complete_ = true;
response_status_ = status;
stream_id_ = 0;
@@ -272,6 +301,8 @@ void SpdyStream::OnClose(int status) {
int SpdyStream::DoLoop(int result) {
do {
+ DLOG(INFO) << " * " << __FUNCTION__ << "() state = " << io_state_
+ << " result = " << result;
State state = io_state_;
io_state_ = STATE_NONE;
switch (state) {