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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: net/http/http_stream_factory_impl_job_controller.cc
diff --git a/net/http/http_stream_factory_impl_job_controller.cc b/net/http/http_stream_factory_impl_job_controller.cc
index c2c818b99d63c16bd7dd9f949e45063212e72d46..207a9c36fed9ec0ac33403bab292ca33df7085ce 100644
--- a/net/http/http_stream_factory_impl_job_controller.cc
+++ b/net/http/http_stream_factory_impl_job_controller.cc
@@ -1168,6 +1168,12 @@ HttpStreamFactoryImpl::JobController::GetAlternativeServiceInfoInternal(
if (!original_url.SchemeIs(url::kHttpsScheme))
continue;
+ // If there is no QUIC version in the advertised versions supported by
+ // the net stack, ignore this entry.
+ if (SelectQuicVersion(alternative_service_info.advertised_versions()) ==
+ QUIC_VERSION_UNSUPPORTED)
+ continue;
+
// Check whether there is an existing QUIC session to use for this origin.
HostPortPair mapped_origin(origin.host(), origin.port());
ignore_result(ApplyHostMappingRules(original_url, &mapped_origin));
@@ -1195,6 +1201,25 @@ HttpStreamFactoryImpl::JobController::GetAlternativeServiceInfoInternal(
return first_alternative_service_info;
}
+QuicVersion HttpStreamFactoryImpl::JobController::SelectQuicVersion(
+ const QuicVersionVector& advertised_versions) {
+ const QuicVersionVector& supported_versions =
+ session_->params().quic_supported_versions;
+ if (advertised_versions.empty())
+ return supported_versions[0];
+
+ for (const QuicVersion& supported : supported_versions) {
+ for (const QuicVersion& advertised : advertised_versions) {
+ if (supported == advertised) {
+ DCHECK_NE(QUIC_VERSION_UNSUPPORTED, supported);
+ return supported;
+ }
+ }
+ }
+
+ return QUIC_VERSION_UNSUPPORTED;
+}
+
bool HttpStreamFactoryImpl::JobController::
ShouldCreateAlternativeProxyServerJob(
const ProxyInfo& proxy_info,
« 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