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 9a214234abd6de9006e10ddc4152be1d1f43e947..160582a908fcf8cbf587dc5720091478149b28d7 100644 |
--- a/net/http/http_stream_factory_impl_job_controller.cc |
+++ b/net/http/http_stream_factory_impl_job_controller.cc |
@@ -1133,6 +1133,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) |
Ryan Hamilton
2017/06/30 02:45:11
Since we don't do anything with the return value f
Zhongyi Shi
2017/06/30 21:08:43
I could change to return a boolean in this one, th
Ryan Hamilton
2017/06/30 21:17:31
Makes sense.
|
+ 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)); |
@@ -1160,6 +1166,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, |