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

Unified Diff: net/http/http_server_properties_manager.cc

Issue 1003923002: Revert of Add IsAlternativeServiceBroken(), remove is_broken. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_server_properties_manager.h ('k') | net/http/http_stream_factory_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_server_properties_manager.cc
diff --git a/net/http/http_server_properties_manager.cc b/net/http/http_server_properties_manager.cc
index 9572c899e3d4a5fa3cef8402d262dd5fc8a024d7..d6bfb38cce1ecbf584ea098a4c1a40fe1f8f5ec7 100644
--- a/net/http/http_server_properties_manager.cc
+++ b/net/http/http_server_properties_manager.cc
@@ -204,13 +204,6 @@
ScheduleUpdatePrefsOnNetworkThread();
}
-bool HttpServerPropertiesManager::IsAlternativeServiceBroken(
- const AlternativeService& alternative_service) {
- DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
- return http_server_properties_impl_->IsAlternativeServiceBroken(
- alternative_service);
-}
-
bool HttpServerPropertiesManager::WasAlternateProtocolRecentlyBroken(
const HostPortPair& server) {
DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
@@ -464,7 +457,7 @@
int port = 0;
if (!alternate_protocol_dict.GetInteger(kPortKey, &port) ||
!IsPortValid(port)) {
- DVLOG(1) << "Malformed alternative service port for server: " << server_str;
+ DVLOG(1) << "Malformed AltSvc port for server: " << server_str;
return alternate_protocol;
}
alternate_protocol.port = static_cast<uint16>(port);
@@ -473,8 +466,7 @@
if (alternate_protocol_dict.HasKey(kProbabilityKey) &&
!alternate_protocol_dict.GetDoubleWithoutPathExpansion(kProbabilityKey,
&probability)) {
- DVLOG(1) << "Malformed alternative service probability for server: "
- << server_str;
+ DVLOG(1) << "Malformed AltSvc probability for server: " << server_str;
return alternate_protocol;
}
alternate_protocol.probability = probability;
@@ -482,14 +474,12 @@
std::string protocol_str;
if (!alternate_protocol_dict.GetStringWithoutPathExpansion(kProtocolKey,
&protocol_str)) {
- DVLOG(1) << "Malformed alternative service protocol string for server: "
- << server_str;
+ DVLOG(1) << "Malformed AltSvc protocol string for server: " << server_str;
return alternate_protocol;
}
AlternateProtocol protocol = AlternateProtocolFromString(protocol_str);
if (!IsAlternateProtocolValid(protocol)) {
- DVLOG(1) << "Invalid alternative service protocol string for server: "
- << server_str;
+ DVLOG(1) << "Invalid AltSvc protocol string for server: " << server_str;
return alternate_protocol;
}
alternate_protocol.protocol = protocol;
@@ -659,16 +649,7 @@
CanonicalHostPersistedMap persisted_map;
for (AlternateProtocolMap::const_iterator it = map.begin();
it != map.end() && count < kMaxAlternateProtocolHostsToPersist; ++it) {
- const AlternateProtocolInfo& alternate_protocol = it->second;
- if (!IsAlternateProtocolValid(alternate_protocol.protocol)) {
- continue;
- }
const HostPortPair& server = it->first;
- if (IsAlternativeServiceBroken(
- AlternativeService(alternate_protocol.protocol, server.host(),
- alternate_protocol.port))) {
- continue;
- }
std::string canonical_suffix =
http_server_properties_impl_->GetCanonicalSuffix(server.host());
if (!canonical_suffix.empty()) {
@@ -676,7 +657,7 @@
continue;
persisted_map[canonical_suffix] = true;
}
- alternate_protocol_map->Put(server, alternate_protocol);
+ alternate_protocol_map->Put(server, it->second);
++count;
}
@@ -763,7 +744,12 @@
for (AlternateProtocolMap::const_iterator map_it =
alternate_protocol_map->begin();
map_it != alternate_protocol_map->end(); ++map_it) {
- server_pref_map[map_it->first].alternate_protocol = &map_it->second;
+ const HostPortPair& server = map_it->first;
+ const AlternateProtocolInfo& port_alternate_protocol = map_it->second;
+ if (!IsAlternateProtocolValid(port_alternate_protocol.protocol)) {
+ continue;
+ }
+ server_pref_map[server].alternate_protocol = &map_it->second;
}
// Add ServerNetworkStats servers to server_pref_map.
@@ -835,7 +821,7 @@
void HttpServerPropertiesManager::SaveAlternateProtocolToServerPrefs(
const AlternateProtocolInfo* port_alternate_protocol,
base::DictionaryValue* server_pref_dict) {
- if (!port_alternate_protocol)
+ if (!port_alternate_protocol || port_alternate_protocol->is_broken)
return;
base::DictionaryValue* port_alternate_protocol_dict =
« no previous file with comments | « net/http/http_server_properties_manager.h ('k') | net/http/http_stream_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698