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

Unified Diff: net/http/http_server_properties_manager.cc

Issue 995013004: Add IsAlternativeServiceBroken(), remove is_broken. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More nits. 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 d6bfb38cce1ecbf584ea098a4c1a40fe1f8f5ec7..d6ad7ee3eefbdfa2ae86ce6dd751b637f8c32917 100644
--- a/net/http/http_server_properties_manager.cc
+++ b/net/http/http_server_properties_manager.cc
@@ -204,6 +204,13 @@ void HttpServerPropertiesManager::SetBrokenAlternateProtocol(
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());
@@ -457,7 +464,7 @@ AlternateProtocolInfo HttpServerPropertiesManager::ParseAlternateProtocolDict(
int port = 0;
if (!alternate_protocol_dict.GetInteger(kPortKey, &port) ||
!IsPortValid(port)) {
- DVLOG(1) << "Malformed AltSvc port for server: " << server_str;
+ DVLOG(1) << "Malformed alternative service port for server: " << server_str;
return alternate_protocol;
}
alternate_protocol.port = static_cast<uint16>(port);
@@ -466,7 +473,8 @@ AlternateProtocolInfo HttpServerPropertiesManager::ParseAlternateProtocolDict(
if (alternate_protocol_dict.HasKey(kProbabilityKey) &&
!alternate_protocol_dict.GetDoubleWithoutPathExpansion(kProbabilityKey,
&probability)) {
- DVLOG(1) << "Malformed AltSvc probability for server: " << server_str;
+ DVLOG(1) << "Malformed alternative service probability for server: "
+ << server_str;
return alternate_protocol;
}
alternate_protocol.probability = probability;
@@ -474,12 +482,14 @@ AlternateProtocolInfo HttpServerPropertiesManager::ParseAlternateProtocolDict(
std::string protocol_str;
if (!alternate_protocol_dict.GetStringWithoutPathExpansion(kProtocolKey,
&protocol_str)) {
- DVLOG(1) << "Malformed AltSvc protocol string for server: " << server_str;
+ DVLOG(1) << "Malformed alternative service protocol string for server: "
+ << server_str;
return alternate_protocol;
}
AlternateProtocol protocol = AlternateProtocolFromString(protocol_str);
if (!IsAlternateProtocolValid(protocol)) {
- DVLOG(1) << "Invalid AltSvc protocol string for server: " << server_str;
+ DVLOG(1) << "Invalid alternative service protocol string for server: "
+ << server_str;
return alternate_protocol;
}
alternate_protocol.protocol = protocol;
@@ -775,7 +785,7 @@ void HttpServerPropertiesManager::UpdatePrefsOnPrefThread(
if (server_pref.supports_spdy)
server_pref_dict->SetBoolean(kSupportsSpdyKey, server_pref.supports_spdy);
SaveSpdySettingsToServerPrefs(server_pref.settings_map, server_pref_dict);
- SaveAlternateProtocolToServerPrefs(server_pref.alternate_protocol,
+ SaveAlternateProtocolToServerPrefs(server, server_pref.alternate_protocol,
server_pref_dict);
SaveNetworkStatsToServerPrefs(server_pref.server_network_stats,
server_pref_dict);
@@ -819,9 +829,16 @@ void HttpServerPropertiesManager::SaveSpdySettingsToServerPrefs(
}
void HttpServerPropertiesManager::SaveAlternateProtocolToServerPrefs(
+ const HostPortPair& origin,
const AlternateProtocolInfo* port_alternate_protocol,
base::DictionaryValue* server_pref_dict) {
- if (!port_alternate_protocol || port_alternate_protocol->is_broken)
+ if (!port_alternate_protocol)
+ return;
+
+ const AlternativeService alternative_service(
+ port_alternate_protocol->protocol, origin.host(),
+ port_alternate_protocol->port);
+ if (IsAlternativeServiceBroken(alternative_service))
Ryan Hamilton 2015/03/10 23:11:52 I'm sorry for not noticing this initally, but I th
Bence 2015/03/11 02:47:44 Good catch. Done.
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