Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Unified Diff: net/spdy/spdy_session.cc

Issue 304353012: Introduce STATE_RESERVED_REMOTE. No behavioral changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android build. More robust expectation Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_session.cc
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 0dce82c8ae86087b62899fe8b9d72e44b24ad4f3..1515f02f801b85c29ca54a0f1804606c06ec1c0c 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -387,6 +387,30 @@ SpdyGoAwayStatus MapNetErrorToGoAwayStatus(Error err) {
}
}
+void SplitPushedHeadersToRequestAndResponse(const SpdyHeaderBlock& headers,
+ SpdyMajorVersion protocol_version,
+ SpdyHeaderBlock* request_headers,
+ SpdyHeaderBlock* response_headers) {
+ DCHECK(response_headers);
+ DCHECK(request_headers);
+ for (SpdyHeaderBlock::const_iterator it = headers.begin();
+ it != headers.end();
+ ++it) {
+ SpdyHeaderBlock* to_insert = response_headers;
+ if (protocol_version == SPDY2) {
+ if (it->first == "url")
+ to_insert = request_headers;
+ } else {
+ const char* host = protocol_version >= SPDY4 ? ":authority" : ":host";
+ static const char* scheme = ":scheme";
+ static const char* path = ":path";
+ if (it->first == host || it->first == scheme || it->first == path)
+ to_insert = request_headers;
+ }
+ to_insert->insert(*it);
+ }
+}
+
SpdyStreamRequest::SpdyStreamRequest() : weak_ptr_factory_(this) {
Reset();
}
@@ -2189,9 +2213,21 @@ void SpdySession::OnSynStream(SpdyStreamId stream_id,
}
// Parse the headers.
- if (OnInitialResponseHeadersReceived(
- headers, response_time,
- recv_first_byte_time, active_it->second.stream) != OK)
+
+ // Split headers to simulate push promise and response.
+ SpdyHeaderBlock request_headers;
+ SpdyHeaderBlock response_headers;
+ SplitPushedHeadersToRequestAndResponse(
+ headers, GetProtocolVersion(), &request_headers, &response_headers);
+
+ if (active_it->second.stream->OnPushPromiseHeadersReceived(request_headers) !=
+ OK)
+ return;
+
+ if (OnInitialResponseHeadersReceived(response_headers,
+ response_time,
+ recv_first_byte_time,
+ active_it->second.stream) != OK)
return;
base::StatsCounter push_requests("spdy.pushed_streams");
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698