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

Unified Diff: net/spdy/spdy_session.cc

Issue 2031373002: Process HTTP/2 ALTSVC frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re: #3. Created 4 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 a9565db39265566325f9b983c17c6cb9911cb69e..f82adb2774aed490b5b150eb9ea22aa65a539678 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -2485,6 +2485,61 @@ void SpdySession::OnHeaders(SpdyStreamId stream_id,
}
}
+void SpdySession::OnAltSvc(
+ SpdyStreamId stream_id,
+ base::StringPiece origin,
+ const SpdyAltSvcWireFormat::AlternativeServiceVector& altsvc_vector) {
+ if (!is_secure_)
+ return;
+
+ url::SchemeHostPort scheme_host_port;
+ if (stream_id == 0) {
+ if (origin.empty())
+ return;
+ const GURL gurl(origin);
+ if (!gurl.SchemeIs("https"))
+ return;
+ SSLInfo ssl_info;
+ bool was_npn_negotiated;
+ NextProto protocol_negotiated = kProtoUnknown;
+ if (!GetSSLInfo(&ssl_info, &was_npn_negotiated, &protocol_negotiated))
+ return;
+ if (!CanPool(transport_security_state_, ssl_info, host_port_pair().host(),
+ gurl.host())) {
+ return;
+ }
+ scheme_host_port = url::SchemeHostPort(gurl);
+ } else {
+ if (!origin.empty())
+ return;
+ const ActiveStreamMap::iterator it = active_streams_.find(stream_id);
+ if (it == active_streams_.end())
+ return;
+ const GURL& gurl(it->second.stream->url());
+ if (!gurl.SchemeIs("https"))
+ return;
+ scheme_host_port = url::SchemeHostPort(gurl);
+ }
+
+ AlternativeServiceInfoVector alternative_service_info_vector;
+ alternative_service_info_vector.reserve(altsvc_vector.size());
+ const base::Time now(base::Time::Now());
+ for (const SpdyAltSvcWireFormat::AlternativeService& altsvc : altsvc_vector) {
+ const AlternateProtocol protocol =
+ AlternateProtocolFromString(altsvc.protocol_id);
+ if (protocol == UNINITIALIZED_ALTERNATE_PROTOCOL)
+ continue;
+ const AlternativeService alternative_service(protocol, altsvc.host,
+ altsvc.port);
+ const base::Time expiration =
+ now + base::TimeDelta::FromSeconds(altsvc.max_age);
+ alternative_service_info_vector.push_back(
+ AlternativeServiceInfo(alternative_service, expiration));
+ }
+ http_server_properties_->SetAlternativeServices(
+ scheme_host_port, alternative_service_info_vector);
+}
+
bool SpdySession::OnUnknownFrame(SpdyStreamId stream_id, int frame_type) {
// Validate stream id.
// Was the frame sent on a stream id that has not been used in this session?
« 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