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

Unified Diff: net/http/http_server_properties_impl.cc

Issue 1014303002: Lazy RemoveCanonicalHost(). (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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 84a7a9edb47f226f4b7e94b45996038de4b1d97b..9b3d28a20aa98c2e0d265e0c4249125cecf77797 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -325,10 +325,6 @@ void HttpServerPropertiesImpl::SetBrokenAlternateProtocol(
return;
}
- // Do not leave this host as canonical so that we don't infer the other
- // hosts are also broken without testing them first.
- RemoveCanonicalHost(origin);
-
// If this is the only entry in the list, schedule an expiration task.
// Otherwise it will be rescheduled automatically when the pending task runs.
if (broken_alternative_services_.size() == 1) {
@@ -493,9 +489,23 @@ HttpServerPropertiesImpl::GetAlternateProtocolIterator(
return it;
Ryan Hamilton 2015/03/18 22:44:36 Do you need to (possibly) do the removal here too?
Bence 2015/03/19 12:44:02 It's not necessary. Consider foo being the canoni
Ryan Hamilton 2015/03/19 20:05:18 Ah, I see. Ok, do we have a test which covers this
Bence 2015/03/19 21:43:09 Yes, AlternateProtocolServerPropertiesTest.Canonic
CanonicalHostMap::const_iterator canonical = GetCanonicalHost(server);
- if (canonical != canonical_host_to_origin_map_.end())
- return alternate_protocol_map_.Get(canonical->second);
+ if (canonical == canonical_host_to_origin_map_.end()) {
+ return alternate_protocol_map_.end();
+ }
+
+ const HostPortPair canonical_host_port = canonical->second;
+ it = alternate_protocol_map_.Get(canonical_host_port);
+ if (it == alternate_protocol_map_.end()) {
+ return alternate_protocol_map_.end();
+ }
+
+ const AlternativeService alternative_service(
+ it->second.protocol, canonical_host_port.host(), it->second.port);
+ if (!IsAlternativeServiceBroken(alternative_service)) {
+ return it;
+ }
+ RemoveCanonicalHost(canonical_host_port);
return alternate_protocol_map_.end();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698