Chromium Code Reviews| 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..868971bc0fa71385494e2917b310d09ba3bd326e 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 |
| + // coull use the the same function. |
|
Bence
2017/06/26 15:44:53
s/coull/could/
Zhongyi Shi
2017/06/26 17:29:18
Done.
|
| + // 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 = |