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

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 review remarks 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
Index: net/spdy/spdy_session.cc
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index fab1e0f2bd290fd25158a994841e65467248e763..ff7dedd9919e99a21f12346c48e445178ffb6491 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -340,6 +340,30 @@ SpdyProtocolErrorDetails MapRstStreamStatusToProtocolError(
}
}
+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();
}
@@ -2126,9 +2150,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");

Powered by Google App Engine
This is Rietveld 408576698