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

Unified Diff: net/spdy/chromium/spdy_session.cc

Issue 2955673002: Filter QUIC alternative service if the versions advertised by the server (Closed)
Patch Set: address comments #7 Created 3 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/chromium/spdy_session.h ('k') | net/spdy/chromium/spdy_session_pool.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/chromium/spdy_session.cc
diff --git a/net/spdy/chromium/spdy_session.cc b/net/spdy/chromium/spdy_session.cc
index cdf864b2f5cbf02c9f3652bffeccabcd0ff646b0..8f2921cb7bc0e8b4d7cd6d937d10d6b76462dc6a 100644
--- a/net/spdy/chromium/spdy_session.cc
+++ b/net/spdy/chromium/spdy_session.cc
@@ -729,6 +729,7 @@ bool SpdySession::CanPool(TransportSecurityState* transport_security_state,
SpdySession::SpdySession(const SpdySessionKey& spdy_session_key,
HttpServerProperties* http_server_properties,
TransportSecurityState* transport_security_state,
+ const QuicVersionVector& quic_supported_versions,
bool enable_sending_initial_data,
bool enable_ping_based_connection_checking,
size_t session_max_recv_window_size,
@@ -780,6 +781,7 @@ SpdySession::SpdySession(const SpdySessionKey& spdy_session_key,
initial_settings.at(SETTINGS_INITIAL_WINDOW_SIZE)),
net_log_(
NetLogWithSource::Make(net_log, NetLogSourceType::HTTP2_SESSION)),
+ quic_supported_versions_(quic_supported_versions),
enable_sending_initial_data_(enable_sending_initial_data),
enable_ping_based_connection_checking_(
enable_ping_based_connection_checking),
@@ -3012,10 +3014,35 @@ void SpdySession::OnAltSvc(
AlternativeServiceInfoVector alternative_service_info_vector;
alternative_service_info_vector.reserve(altsvc_vector.size());
const base::Time now(base::Time::Now());
+ DCHECK(!quic_supported_versions_.empty());
for (const SpdyAltSvcWireFormat::AlternativeService& altsvc : altsvc_vector) {
const NextProto protocol = NextProtoFromString(altsvc.protocol_id);
if (protocol == kProtoUnknown)
continue;
+
+ // TODO(zhongyi): refactor the QUIC version filtering to a single function
+ // so that SpdySession::OnAltSvc and
+ // HttpStreamFactory::ProcessAlternativeServices
+ // could use the the same function.
+ // Check if QUIC version is supported.
+ if (protocol == kProtoQUIC && !altsvc.version.empty()) {
+ bool match_found = false;
+ for (const QuicVersion& supported : quic_supported_versions_) {
+ for (const uint16_t& advertised : altsvc.version) {
+ if (supported == advertised) {
+ match_found = true;
+ break;
+ }
+ }
+ if (match_found) {
+ break;
+ }
+ }
+ if (!match_found) {
+ continue;
+ }
+ }
+
const AlternativeService alternative_service(protocol, altsvc.host,
altsvc.port);
const base::Time expiration =
« no previous file with comments | « net/spdy/chromium/spdy_session.h ('k') | net/spdy/chromium/spdy_session_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698