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

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

Issue 2964603002: JobController: do not create alternative job for those AlternativeServiceInfo (Closed)
Patch Set: Always initialize local variable to fix windows compile issue 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
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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_job_controller.h" 5 #include "net/http/http_stream_factory_impl_job_controller.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 continue; 1161 continue;
1162 1162
1163 if (stream_type == HttpStreamRequest::BIDIRECTIONAL_STREAM && 1163 if (stream_type == HttpStreamRequest::BIDIRECTIONAL_STREAM &&
1164 session_->params().quic_disable_bidirectional_streams) { 1164 session_->params().quic_disable_bidirectional_streams) {
1165 continue; 1165 continue;
1166 } 1166 }
1167 1167
1168 if (!original_url.SchemeIs(url::kHttpsScheme)) 1168 if (!original_url.SchemeIs(url::kHttpsScheme))
1169 continue; 1169 continue;
1170 1170
1171 // If there is no QUIC version in the advertised versions supported by
1172 // the net stack, ignore this entry.
1173 if (SelectQuicVersion(alternative_service_info.advertised_versions()) ==
1174 QUIC_VERSION_UNSUPPORTED)
1175 continue;
1176
1171 // Check whether there is an existing QUIC session to use for this origin. 1177 // Check whether there is an existing QUIC session to use for this origin.
1172 HostPortPair mapped_origin(origin.host(), origin.port()); 1178 HostPortPair mapped_origin(origin.host(), origin.port());
1173 ignore_result(ApplyHostMappingRules(original_url, &mapped_origin)); 1179 ignore_result(ApplyHostMappingRules(original_url, &mapped_origin));
1174 QuicServerId server_id(mapped_origin, request_info.privacy_mode); 1180 QuicServerId server_id(mapped_origin, request_info.privacy_mode);
1175 1181
1176 HostPortPair destination( 1182 HostPortPair destination(
1177 alternative_service_info.alternative_service().host_port_pair()); 1183 alternative_service_info.alternative_service().host_port_pair());
1178 ignore_result(ApplyHostMappingRules(original_url, &destination)); 1184 ignore_result(ApplyHostMappingRules(original_url, &destination));
1179 1185
1180 if (session_->quic_stream_factory()->CanUseExistingSession(server_id, 1186 if (session_->quic_stream_factory()->CanUseExistingSession(server_id,
1181 destination)) { 1187 destination)) {
1182 return alternative_service_info; 1188 return alternative_service_info;
1183 } 1189 }
1184 1190
1185 // Cache this entry if we don't have a non-broken Alt-Svc yet. 1191 // Cache this entry if we don't have a non-broken Alt-Svc yet.
1186 if (first_alternative_service_info.alternative_service().protocol == 1192 if (first_alternative_service_info.alternative_service().protocol ==
1187 kProtoUnknown) 1193 kProtoUnknown)
1188 first_alternative_service_info = alternative_service_info; 1194 first_alternative_service_info = alternative_service_info;
1189 } 1195 }
1190 1196
1191 // Ask delegate to mark QUIC as broken for the origin. 1197 // Ask delegate to mark QUIC as broken for the origin.
1192 if (quic_advertised && quic_all_broken && delegate != nullptr) 1198 if (quic_advertised && quic_all_broken && delegate != nullptr)
1193 delegate->OnQuicBroken(); 1199 delegate->OnQuicBroken();
1194 1200
1195 return first_alternative_service_info; 1201 return first_alternative_service_info;
1196 } 1202 }
1197 1203
1204 QuicVersion HttpStreamFactoryImpl::JobController::SelectQuicVersion(
1205 const QuicVersionVector& advertised_versions) {
1206 const QuicVersionVector& supported_versions =
1207 session_->params().quic_supported_versions;
1208 if (advertised_versions.empty())
1209 return supported_versions[0];
1210
1211 for (const QuicVersion& supported : supported_versions) {
1212 for (const QuicVersion& advertised : advertised_versions) {
1213 if (supported == advertised) {
1214 DCHECK_NE(QUIC_VERSION_UNSUPPORTED, supported);
1215 return supported;
1216 }
1217 }
1218 }
1219
1220 return QUIC_VERSION_UNSUPPORTED;
1221 }
1222
1198 bool HttpStreamFactoryImpl::JobController:: 1223 bool HttpStreamFactoryImpl::JobController::
1199 ShouldCreateAlternativeProxyServerJob( 1224 ShouldCreateAlternativeProxyServerJob(
1200 const ProxyInfo& proxy_info, 1225 const ProxyInfo& proxy_info,
1201 const GURL& url, 1226 const GURL& url,
1202 ProxyServer* alternative_proxy_server) const { 1227 ProxyServer* alternative_proxy_server) const {
1203 DCHECK(!alternative_proxy_server->is_valid()); 1228 DCHECK(!alternative_proxy_server->is_valid());
1204 1229
1205 if (!enable_alternative_services_) 1230 if (!enable_alternative_services_)
1206 return false; 1231 return false;
1207 1232
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 // If ReconsiderProxyAfterError() failed synchronously, it means 1346 // If ReconsiderProxyAfterError() failed synchronously, it means
1322 // there was nothing left to fall-back to, so fail the transaction 1347 // there was nothing left to fall-back to, so fail the transaction
1323 // with the last connection error we got. 1348 // with the last connection error we got.
1324 // TODO(eroman): This is a confusing contract, make it more obvious. 1349 // TODO(eroman): This is a confusing contract, make it more obvious.
1325 rv = error; 1350 rv = error;
1326 } 1351 }
1327 return rv; 1352 return rv;
1328 } 1353 }
1329 1354
1330 } // namespace net 1355 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_job_controller.h ('k') | net/http/http_stream_factory_impl_job_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698