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

Side by Side 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, 5 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/spdy/chromium/spdy_session.h" 5 #include "net/spdy/chromium/spdy_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 TransportSecurityState::CT_REQUIREMENTS_MET) { 722 TransportSecurityState::CT_REQUIREMENTS_MET) {
723 return false; 723 return false;
724 } 724 }
725 725
726 return true; 726 return true;
727 } 727 }
728 728
729 SpdySession::SpdySession(const SpdySessionKey& spdy_session_key, 729 SpdySession::SpdySession(const SpdySessionKey& spdy_session_key,
730 HttpServerProperties* http_server_properties, 730 HttpServerProperties* http_server_properties,
731 TransportSecurityState* transport_security_state, 731 TransportSecurityState* transport_security_state,
732 const QuicVersionVector& quic_supported_versions,
732 bool enable_sending_initial_data, 733 bool enable_sending_initial_data,
733 bool enable_ping_based_connection_checking, 734 bool enable_ping_based_connection_checking,
734 size_t session_max_recv_window_size, 735 size_t session_max_recv_window_size,
735 const SettingsMap& initial_settings, 736 const SettingsMap& initial_settings,
736 TimeFunc time_func, 737 TimeFunc time_func,
737 ServerPushDelegate* push_delegate, 738 ServerPushDelegate* push_delegate,
738 ProxyDelegate* proxy_delegate, 739 ProxyDelegate* proxy_delegate,
739 NetLog* net_log) 740 NetLog* net_log)
740 : in_io_loop_(false), 741 : in_io_loop_(false),
741 spdy_session_key_(spdy_session_key), 742 spdy_session_key_(spdy_session_key),
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 session_send_window_size_(0), 774 session_send_window_size_(0),
774 session_max_recv_window_size_(session_max_recv_window_size), 775 session_max_recv_window_size_(session_max_recv_window_size),
775 session_recv_window_size_(0), 776 session_recv_window_size_(0),
776 session_unacked_recv_window_bytes_(0), 777 session_unacked_recv_window_bytes_(0),
777 stream_initial_send_window_size_(kDefaultInitialWindowSize), 778 stream_initial_send_window_size_(kDefaultInitialWindowSize),
778 max_header_table_size_(initial_settings.at(SETTINGS_HEADER_TABLE_SIZE)), 779 max_header_table_size_(initial_settings.at(SETTINGS_HEADER_TABLE_SIZE)),
779 stream_max_recv_window_size_( 780 stream_max_recv_window_size_(
780 initial_settings.at(SETTINGS_INITIAL_WINDOW_SIZE)), 781 initial_settings.at(SETTINGS_INITIAL_WINDOW_SIZE)),
781 net_log_( 782 net_log_(
782 NetLogWithSource::Make(net_log, NetLogSourceType::HTTP2_SESSION)), 783 NetLogWithSource::Make(net_log, NetLogSourceType::HTTP2_SESSION)),
784 quic_supported_versions_(quic_supported_versions),
783 enable_sending_initial_data_(enable_sending_initial_data), 785 enable_sending_initial_data_(enable_sending_initial_data),
784 enable_ping_based_connection_checking_( 786 enable_ping_based_connection_checking_(
785 enable_ping_based_connection_checking), 787 enable_ping_based_connection_checking),
786 connection_at_risk_of_loss_time_( 788 connection_at_risk_of_loss_time_(
787 base::TimeDelta::FromSeconds(kDefaultConnectionAtRiskOfLossSeconds)), 789 base::TimeDelta::FromSeconds(kDefaultConnectionAtRiskOfLossSeconds)),
788 hung_interval_(base::TimeDelta::FromSeconds(kHungIntervalSeconds)), 790 hung_interval_(base::TimeDelta::FromSeconds(kHungIntervalSeconds)),
789 proxy_delegate_(proxy_delegate), 791 proxy_delegate_(proxy_delegate),
790 time_func_(time_func), 792 time_func_(time_func),
791 weak_factory_(this) { 793 weak_factory_(this) {
792 net_log_.BeginEvent( 794 net_log_.BeginEvent(
(...skipping 2212 matching lines...) Expand 10 before | Expand all | Expand 10 after
3005 return; 3007 return;
3006 const GURL& gurl(it->second->url()); 3008 const GURL& gurl(it->second->url());
3007 if (!gurl.SchemeIs("https")) 3009 if (!gurl.SchemeIs("https"))
3008 return; 3010 return;
3009 scheme_host_port = url::SchemeHostPort(gurl); 3011 scheme_host_port = url::SchemeHostPort(gurl);
3010 } 3012 }
3011 3013
3012 AlternativeServiceInfoVector alternative_service_info_vector; 3014 AlternativeServiceInfoVector alternative_service_info_vector;
3013 alternative_service_info_vector.reserve(altsvc_vector.size()); 3015 alternative_service_info_vector.reserve(altsvc_vector.size());
3014 const base::Time now(base::Time::Now()); 3016 const base::Time now(base::Time::Now());
3017 DCHECK(!quic_supported_versions_.empty());
3015 for (const SpdyAltSvcWireFormat::AlternativeService& altsvc : altsvc_vector) { 3018 for (const SpdyAltSvcWireFormat::AlternativeService& altsvc : altsvc_vector) {
3016 const NextProto protocol = NextProtoFromString(altsvc.protocol_id); 3019 const NextProto protocol = NextProtoFromString(altsvc.protocol_id);
3017 if (protocol == kProtoUnknown) 3020 if (protocol == kProtoUnknown)
3018 continue; 3021 continue;
3022
3023 // TODO(zhongyi): refactor the QUIC version filtering to a single function
3024 // so that SpdySession::OnAltSvc and
3025 // HttpStreamFactory::ProcessAlternativeServices
3026 // could use the the same function.
3027 // Check if QUIC version is supported.
3028 if (protocol == kProtoQUIC && !altsvc.version.empty()) {
3029 bool match_found = false;
3030 for (const QuicVersion& supported : quic_supported_versions_) {
3031 for (const uint16_t& advertised : altsvc.version) {
3032 if (supported == advertised) {
3033 match_found = true;
3034 break;
3035 }
3036 }
3037 if (match_found) {
3038 break;
3039 }
3040 }
3041 if (!match_found) {
3042 continue;
3043 }
3044 }
3045
3019 const AlternativeService alternative_service(protocol, altsvc.host, 3046 const AlternativeService alternative_service(protocol, altsvc.host,
3020 altsvc.port); 3047 altsvc.port);
3021 const base::Time expiration = 3048 const base::Time expiration =
3022 now + base::TimeDelta::FromSeconds(altsvc.max_age); 3049 now + base::TimeDelta::FromSeconds(altsvc.max_age);
3023 alternative_service_info_vector.push_back( 3050 alternative_service_info_vector.push_back(
3024 AlternativeServiceInfo(alternative_service, expiration)); 3051 AlternativeServiceInfo(alternative_service, expiration));
3025 } 3052 }
3026 http_server_properties_->SetAlternativeServices( 3053 http_server_properties_->SetAlternativeServices(
3027 scheme_host_port, alternative_service_info_vector); 3054 scheme_host_port, alternative_service_info_vector);
3028 } 3055 }
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
3230 if (!queue->empty()) { 3257 if (!queue->empty()) {
3231 SpdyStreamId stream_id = queue->front(); 3258 SpdyStreamId stream_id = queue->front();
3232 queue->pop_front(); 3259 queue->pop_front();
3233 return stream_id; 3260 return stream_id;
3234 } 3261 }
3235 } 3262 }
3236 return 0; 3263 return 0;
3237 } 3264 }
3238 3265
3239 } // namespace net 3266 } // namespace net
OLDNEW
« 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