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

Side by Side Diff: net/http/http_stream_factory_impl.cc

Issue 1796253002: Add an option to disable net::BidirectionalStreamQuicImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Misha's comments Created 4 years, 9 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
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/http/http_stream_factory_impl.h" 5 #include "net/http/http_stream_factory_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 websocket_handshake_stream_create_helper, 103 websocket_handshake_stream_create_helper,
104 net_log, stream_type); 104 net_log, stream_type);
105 HostPortPair server = HostPortPair::FromURL(request_info.url); 105 HostPortPair server = HostPortPair::FromURL(request_info.url);
106 GURL origin_url = ApplyHostMappingRules(request_info.url, &server); 106 GURL origin_url = ApplyHostMappingRules(request_info.url, &server);
107 107
108 Job* job = new Job(this, session_, request_info, priority, server_ssl_config, 108 Job* job = new Job(this, session_, request_info, priority, server_ssl_config,
109 proxy_ssl_config, server, origin_url, net_log.net_log()); 109 proxy_ssl_config, server, origin_url, net_log.net_log());
110 request->AttachJob(job); 110 request->AttachJob(job);
111 111
112 const AlternativeService alternative_service = 112 const AlternativeService alternative_service =
113 GetAlternativeServiceFor(request_info, delegate); 113 GetAlternativeServiceFor(request_info, delegate, stream_type);
114 114
115 if (alternative_service.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL) { 115 if (alternative_service.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL) {
116 // Never share connection with other jobs for FTP requests. 116 // Never share connection with other jobs for FTP requests.
117 DVLOG(1) << "Selected alternative service (host: " 117 DVLOG(1) << "Selected alternative service (host: "
118 << alternative_service.host_port_pair().host() 118 << alternative_service.host_port_pair().host()
119 << " port: " << alternative_service.host_port_pair().port() << ")"; 119 << " port: " << alternative_service.host_port_pair().port() << ")";
120 120
121 DCHECK(!request_info.url.SchemeIs("ftp")); 121 DCHECK(!request_info.url.SchemeIs("ftp"));
122 HostPortPair server = alternative_service.host_port_pair(); 122 HostPortPair server = alternative_service.host_port_pair();
123 GURL origin_url = ApplyHostMappingRules(request_info.url, &server); 123 GURL origin_url = ApplyHostMappingRules(request_info.url, &server);
(...skipping 17 matching lines...) Expand all
141 job->Start(request); 141 job->Start(request);
142 return request; 142 return request;
143 } 143 }
144 144
145 void HttpStreamFactoryImpl::PreconnectStreams( 145 void HttpStreamFactoryImpl::PreconnectStreams(
146 int num_streams, 146 int num_streams,
147 const HttpRequestInfo& request_info, 147 const HttpRequestInfo& request_info,
148 const SSLConfig& server_ssl_config, 148 const SSLConfig& server_ssl_config,
149 const SSLConfig& proxy_ssl_config) { 149 const SSLConfig& proxy_ssl_config) {
150 DCHECK(!for_websockets_); 150 DCHECK(!for_websockets_);
151 AlternativeService alternative_service = 151 AlternativeService alternative_service = GetAlternativeServiceFor(
152 GetAlternativeServiceFor(request_info, nullptr); 152 request_info, nullptr, HttpStreamRequest::HTTP_STREAM);
153 HostPortPair server; 153 HostPortPair server;
154 if (alternative_service.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL) { 154 if (alternative_service.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL) {
155 server = alternative_service.host_port_pair(); 155 server = alternative_service.host_port_pair();
156 if (session_->params().quic_disable_preconnect_if_0rtt && 156 if (session_->params().quic_disable_preconnect_if_0rtt &&
157 alternative_service.protocol == QUIC && 157 alternative_service.protocol == QUIC &&
158 session_->quic_stream_factory()->ZeroRTTEnabledFor(QuicServerId( 158 session_->quic_stream_factory()->ZeroRTTEnabledFor(QuicServerId(
159 alternative_service.host_port_pair(), request_info.privacy_mode))) { 159 alternative_service.host_port_pair(), request_info.privacy_mode))) {
160 return; 160 return;
161 } 161 }
162 } else { 162 } else {
(...skipping 10 matching lines...) Expand all
173 preconnect_job_set_.insert(job); 173 preconnect_job_set_.insert(job);
174 job->Preconnect(num_streams); 174 job->Preconnect(num_streams);
175 } 175 }
176 176
177 const HostMappingRules* HttpStreamFactoryImpl::GetHostMappingRules() const { 177 const HostMappingRules* HttpStreamFactoryImpl::GetHostMappingRules() const {
178 return session_->params().host_mapping_rules; 178 return session_->params().host_mapping_rules;
179 } 179 }
180 180
181 AlternativeService HttpStreamFactoryImpl::GetAlternativeServiceFor( 181 AlternativeService HttpStreamFactoryImpl::GetAlternativeServiceFor(
182 const HttpRequestInfo& request_info, 182 const HttpRequestInfo& request_info,
183 HttpStreamRequest::Delegate* delegate) { 183 HttpStreamRequest::Delegate* delegate,
184 HttpStreamRequest::StreamType stream_type) {
184 GURL original_url = request_info.url; 185 GURL original_url = request_info.url;
185 186
186 if (original_url.SchemeIs("ftp")) 187 if (original_url.SchemeIs("ftp"))
187 return AlternativeService(); 188 return AlternativeService();
188 189
190 if (stream_type == HttpStreamRequest::BIDIRECTIONAL_STREAM &&
191 session_->params().disable_bidirectional_stream_quic_impl) {
192 return AlternativeService();
Ryan Hamilton 2016/03/15 22:41:45 This also disable non-QUIC based AlternativeServic
xunjieli 2016/03/16 15:47:04 Done.
193 }
194
189 HostPortPair origin = HostPortPair::FromURL(original_url); 195 HostPortPair origin = HostPortPair::FromURL(original_url);
190 HttpServerProperties& http_server_properties = 196 HttpServerProperties& http_server_properties =
191 *session_->http_server_properties(); 197 *session_->http_server_properties();
192 const AlternativeServiceVector alternative_service_vector = 198 const AlternativeServiceVector alternative_service_vector =
193 http_server_properties.GetAlternativeServices(origin); 199 http_server_properties.GetAlternativeServices(origin);
194 if (alternative_service_vector.empty()) 200 if (alternative_service_vector.empty())
195 return AlternativeService(); 201 return AlternativeService();
196 202
197 bool quic_advertised = false; 203 bool quic_advertised = false;
198 bool quic_all_broken = true; 204 bool quic_all_broken = true;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 return true; 366 return true;
361 367
362 if (session_->params().transport_security_state->IsGooglePinnedHost(host)) 368 if (session_->params().transport_security_state->IsGooglePinnedHost(host))
363 return true; 369 return true;
364 370
365 return ContainsKey(session_->params().quic_host_whitelist, 371 return ContainsKey(session_->params().quic_host_whitelist,
366 base::ToLowerASCII(host)); 372 base::ToLowerASCII(host));
367 } 373 }
368 374
369 } // namespace net 375 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698