Index: net/http/http_server_properties_impl.cc |
diff --git a/net/http/http_server_properties_impl.cc b/net/http/http_server_properties_impl.cc |
index b96a4b27d707291d89ce5a9629f96cf4b447cb48..843a01719c06070e496944c42807e40dff8a3539 100644 |
--- a/net/http/http_server_properties_impl.cc |
+++ b/net/http/http_server_properties_impl.cc |
@@ -287,8 +287,16 @@ HttpServerPropertiesImpl::GetAlternativeServiceInfos( |
++it; |
continue; |
} |
- valid_alternative_service_infos.push_back( |
- AlternativeServiceInfo(alternative_service, it->expiration())); |
+ if (alternative_service.protocol == kProtoQUIC) { |
+ valid_alternative_service_infos.push_back( |
+ AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( |
+ alternative_service, it->expiration(), |
+ it->advertised_versions())); |
+ } else { |
+ valid_alternative_service_infos.push_back( |
+ AlternativeServiceInfo::CreateHttp2AlternativeServiceInfo( |
+ alternative_service, it->expiration())); |
+ } |
++it; |
} |
if (map_it->second.empty()) { |
@@ -323,8 +331,16 @@ HttpServerPropertiesImpl::GetAlternativeServiceInfos( |
++it; |
continue; |
} |
- valid_alternative_service_infos.push_back( |
- AlternativeServiceInfo(alternative_service, it->expiration())); |
+ if (alternative_service.protocol == kProtoQUIC) { |
+ valid_alternative_service_infos.push_back( |
+ AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( |
+ alternative_service, it->expiration(), |
+ it->advertised_versions())); |
+ } else { |
+ valid_alternative_service_infos.push_back( |
+ AlternativeServiceInfo::CreateHttp2AlternativeServiceInfo( |
+ alternative_service, it->expiration())); |
+ } |
++it; |
} |
if (map_it->second.empty()) { |
@@ -333,14 +349,31 @@ HttpServerPropertiesImpl::GetAlternativeServiceInfos( |
return valid_alternative_service_infos; |
} |
-bool HttpServerPropertiesImpl::SetAlternativeService( |
+bool HttpServerPropertiesImpl::SetHttp2AlternativeService( |
const url::SchemeHostPort& origin, |
const AlternativeService& alternative_service, |
base::Time expiration) { |
+ DCHECK_EQ(alternative_service.protocol, kProtoHTTP2); |
+ |
return SetAlternativeServices( |
origin, |
AlternativeServiceInfoVector( |
- /*size=*/1, AlternativeServiceInfo(alternative_service, expiration))); |
+ /*size=*/1, AlternativeServiceInfo::CreateHttp2AlternativeServiceInfo( |
+ alternative_service, expiration))); |
+} |
+ |
+bool HttpServerPropertiesImpl::SetQuicAlternativeService( |
+ const url::SchemeHostPort& origin, |
+ const AlternativeService& alternative_service, |
+ base::Time expiration, |
+ const QuicVersionVector& advertised_versions) { |
+ DCHECK(alternative_service.protocol == kProtoQUIC); |
+ |
+ return SetAlternativeServices( |
+ origin, AlternativeServiceInfoVector( |
+ /*size=*/1, |
+ AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( |
+ alternative_service, expiration, advertised_versions))); |
} |
bool HttpServerPropertiesImpl::SetAlternativeServices( |
@@ -380,6 +413,12 @@ bool HttpServerPropertiesImpl::SetAlternativeServices( |
changed = true; |
break; |
} |
+ // Also persist to disk if new entry has a different list of advertised |
+ // versions. |
+ if (old.advertised_versions() != new_it->advertised_versions()) { |
+ changed = true; |
+ break; |
+ } |
++new_it; |
} |
} |