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

Side by Side Diff: net/http/http_server_properties_impl.cc

Issue 1878143005: SHP 4: Change AlternativeServiceMap to use SchemeHostPort as the key. No change to Pref data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@SHP_3
Patch Set: fix a comment Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_server_properties_impl.h" 5 #include "net/http/http_server_properties_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // Add the entries from the memory cache. 98 // Add the entries from the memory cache.
99 for (AlternativeServiceMap::reverse_iterator input_it = 99 for (AlternativeServiceMap::reverse_iterator input_it =
100 new_alternative_service_map.rbegin(); 100 new_alternative_service_map.rbegin();
101 input_it != new_alternative_service_map.rend(); ++input_it) { 101 input_it != new_alternative_service_map.rend(); ++input_it) {
102 if (alternative_service_map_.Get(input_it->first) == 102 if (alternative_service_map_.Get(input_it->first) ==
103 alternative_service_map_.end()) { 103 alternative_service_map_.end()) {
104 alternative_service_map_.Put(input_it->first, input_it->second); 104 alternative_service_map_.Put(input_it->first, input_it->second);
105 } 105 }
106 } 106 }
107 107
108 // Attempt to find canonical servers. 108 // Attempt to find canonical servers. Canonical suffix only apply to HTTPS.
Ryan Hamilton 2016/04/18 17:18:40 Does this represent a behavior change? If so, is t
Zhongyi Shi 2016/04/18 19:26:37 According to our discussion (https://codereview.ch
109 uint16_t canonical_ports[] = {80, 443}; 109 uint16_t canonical_ports = 443;
Ryan Hamilton 2016/04/18 17:18:40 Since this is a single port, you could say _port i
Zhongyi Shi 2016/04/18 19:26:37 Done.
110 for (size_t i = 0; i < canonical_suffixes_.size(); ++i) { 110 for (size_t i = 0; i < canonical_suffixes_.size(); ++i) {
111 std::string canonical_suffix = canonical_suffixes_[i]; 111 std::string canonical_suffix = canonical_suffixes_[i];
112 for (size_t j = 0; j < arraysize(canonical_ports); ++j) { 112 url::SchemeHostPort canonical_host("https", canonical_suffix,
Ryan Hamilton 2016/04/18 17:18:40 nit s/_host/_server/?
Zhongyi Shi 2016/04/18 19:26:37 Done.
113 HostPortPair canonical_host(canonical_suffix, canonical_ports[j]); 113 canonical_ports);
114 // If we already have a valid canonical server, we're done. 114 // If we already have a valid canonical server, we're done.
115 if (ContainsKey(canonical_host_to_origin_map_, canonical_host) && 115 if (ContainsKey(canonical_host_to_origin_map_, canonical_host) &&
116 (alternative_service_map_.Peek( 116 (alternative_service_map_.Peek(
117 canonical_host_to_origin_map_[canonical_host]) != 117 canonical_host_to_origin_map_[canonical_host]) !=
118 alternative_service_map_.end())) { 118 alternative_service_map_.end())) {
119 continue; 119 continue;
120 } 120 }
121 // Now attempt to find a server which matches this origin and set it as 121 // Now attempt to find a server which matches this origin and set it as
122 // canonical. 122 // canonical.
123 for (AlternativeServiceMap::const_iterator it = 123 for (AlternativeServiceMap::const_iterator it =
124 alternative_service_map_.begin(); 124 alternative_service_map_.begin();
125 it != alternative_service_map_.end(); ++it) { 125 it != alternative_service_map_.end(); ++it) {
126 if (base::EndsWith(it->first.host(), canonical_suffixes_[i], 126 if (base::EndsWith(it->first.host(), canonical_suffixes_[i],
127 base::CompareCase::INSENSITIVE_ASCII)) { 127 base::CompareCase::INSENSITIVE_ASCII) &&
128 canonical_host_to_origin_map_[canonical_host] = it->first; 128 it->first.scheme() == "https") {
Ryan Hamilton 2016/04/18 17:18:40 nit: instead of checking https here, you can use c
Zhongyi Shi 2016/04/18 19:26:37 Done.
129 break; 129 canonical_host_to_origin_map_[canonical_host] = it->first;
130 } 130 break;
131 } 131 }
132 } 132 }
133 } 133 }
134 } 134 }
135 135
136 void HttpServerPropertiesImpl::InitializeSpdySettingsServers( 136 void HttpServerPropertiesImpl::InitializeSpdySettingsServers(
137 SpdySettingsMap* spdy_settings_map) { 137 SpdySettingsMap* spdy_settings_map) {
138 // Add the entries from persisted data. 138 // Add the entries from persisted data.
139 SpdySettingsMap new_spdy_settings_map(SpdySettingsMap::NO_AUTO_EVICT); 139 SpdySettingsMap new_spdy_settings_map(SpdySettingsMap::NO_AUTO_EVICT);
140 for (SpdySettingsMap::reverse_iterator it = spdy_settings_map->rbegin(); 140 for (SpdySettingsMap::reverse_iterator it = spdy_settings_map->rbegin();
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 alternative_service_map_.Clear(); 229 alternative_service_map_.Clear();
230 canonical_host_to_origin_map_.clear(); 230 canonical_host_to_origin_map_.clear();
231 spdy_settings_map_.Clear(); 231 spdy_settings_map_.Clear();
232 last_quic_address_ = IPAddress(); 232 last_quic_address_ = IPAddress();
233 server_network_stats_map_.Clear(); 233 server_network_stats_map_.Clear();
234 quic_server_info_map_.Clear(); 234 quic_server_info_map_.Clear();
235 } 235 }
236 236
237 bool HttpServerPropertiesImpl::SupportsRequestPriority( 237 bool HttpServerPropertiesImpl::SupportsRequestPriority(
238 const url::SchemeHostPort& server) { 238 const url::SchemeHostPort& server) {
239 HostPortPair host_port_pair(server.host(), server.port());
240 DCHECK(CalledOnValidThread()); 239 DCHECK(CalledOnValidThread());
241 if (server.host().empty()) 240 if (server.host().empty())
242 return false; 241 return false;
243 242
244 if (GetSupportsSpdy(server)) 243 if (GetSupportsSpdy(server))
245 return true; 244 return true;
246 const AlternativeServiceVector alternative_service_vector = 245 const AlternativeServiceVector alternative_service_vector =
247 GetAlternativeServices(host_port_pair); 246 GetAlternativeServices(server);
248 for (const AlternativeService& alternative_service : 247 for (const AlternativeService& alternative_service :
249 alternative_service_vector) { 248 alternative_service_vector) {
250 if (alternative_service.protocol == QUIC) { 249 if (alternative_service.protocol == QUIC) {
251 return true; 250 return true;
252 } 251 }
253 } 252 }
254 return false; 253 return false;
255 } 254 }
256 255
257 bool HttpServerPropertiesImpl::GetSupportsSpdy( 256 bool HttpServerPropertiesImpl::GetSupportsSpdy(
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 std::string canonical_suffix = canonical_suffixes_[i]; 314 std::string canonical_suffix = canonical_suffixes_[i];
316 if (base::EndsWith(host, canonical_suffixes_[i], 315 if (base::EndsWith(host, canonical_suffixes_[i],
317 base::CompareCase::INSENSITIVE_ASCII)) { 316 base::CompareCase::INSENSITIVE_ASCII)) {
318 return canonical_suffix; 317 return canonical_suffix;
319 } 318 }
320 } 319 }
321 return std::string(); 320 return std::string();
322 } 321 }
323 322
324 AlternativeServiceVector HttpServerPropertiesImpl::GetAlternativeServices( 323 AlternativeServiceVector HttpServerPropertiesImpl::GetAlternativeServices(
325 const HostPortPair& origin) { 324 const url::SchemeHostPort& origin) {
325 HostPortPair host_port_pair(origin.host(), origin.port());
Ryan Hamilton 2016/04/18 17:18:40 nit: move this down to where it's used.
Zhongyi Shi 2016/04/18 19:26:37 Done.
326 // Copy valid alternative services into |valid_alternative_services|. 326 // Copy valid alternative services into |valid_alternative_services|.
327 AlternativeServiceVector valid_alternative_services; 327 AlternativeServiceVector valid_alternative_services;
328 const base::Time now = base::Time::Now(); 328 const base::Time now = base::Time::Now();
329 AlternativeServiceMap::iterator map_it = alternative_service_map_.Get(origin); 329 AlternativeServiceMap::iterator map_it = alternative_service_map_.Get(origin);
330 if (map_it != alternative_service_map_.end()) { 330 if (map_it != alternative_service_map_.end()) {
331 for (AlternativeServiceInfoVector::iterator it = map_it->second.begin(); 331 for (AlternativeServiceInfoVector::iterator it = map_it->second.begin();
332 it != map_it->second.end();) { 332 it != map_it->second.end();) {
333 if (it->expiration < now) { 333 if (it->expiration < now) {
334 it = map_it->second.erase(it); 334 it = map_it->second.erase(it);
335 continue; 335 continue;
336 } 336 }
337 AlternativeService alternative_service(it->alternative_service); 337 AlternativeService alternative_service(it->alternative_service);
338 if (alternative_service.host.empty()) { 338 if (alternative_service.host.empty()) {
339 alternative_service.host = origin.host(); 339 alternative_service.host = origin.host();
340 } 340 }
341 // If the alternative service is equivalent to the origin (same host, same 341 // If the alternative service is equivalent to the origin (same host, same
342 // port, and both TCP), then there is already a Job for it, so do not 342 // port, and both TCP), then there is already a Job for it, so do not
Ryan Hamilton 2016/04/18 17:18:40 nit: Can you change the comment to remove the ment
Zhongyi Shi 2016/04/18 19:26:37 Done.
343 // return it here. 343 // return it here.
344 if (origin.Equals(alternative_service.host_port_pair()) && 344 if (host_port_pair.Equals(alternative_service.host_port_pair()) &&
345 NPN_SPDY_MINIMUM_VERSION <= alternative_service.protocol && 345 NPN_SPDY_MINIMUM_VERSION <= alternative_service.protocol &&
346 alternative_service.protocol <= NPN_SPDY_MAXIMUM_VERSION) { 346 alternative_service.protocol <= NPN_SPDY_MAXIMUM_VERSION) {
347 ++it; 347 ++it;
348 continue; 348 continue;
349 } 349 }
350 valid_alternative_services.push_back(alternative_service); 350 valid_alternative_services.push_back(alternative_service);
351 ++it; 351 ++it;
352 } 352 }
353 if (map_it->second.empty()) { 353 if (map_it->second.empty()) {
354 alternative_service_map_.Erase(map_it); 354 alternative_service_map_.Erase(map_it);
(...skipping 30 matching lines...) Expand all
385 valid_alternative_services.push_back(alternative_service); 385 valid_alternative_services.push_back(alternative_service);
386 ++it; 386 ++it;
387 } 387 }
388 if (map_it->second.empty()) { 388 if (map_it->second.empty()) {
389 alternative_service_map_.Erase(map_it); 389 alternative_service_map_.Erase(map_it);
390 } 390 }
391 return valid_alternative_services; 391 return valid_alternative_services;
392 } 392 }
393 393
394 bool HttpServerPropertiesImpl::SetAlternativeService( 394 bool HttpServerPropertiesImpl::SetAlternativeService(
395 const HostPortPair& origin, 395 const url::SchemeHostPort& origin,
396 const AlternativeService& alternative_service, 396 const AlternativeService& alternative_service,
397 base::Time expiration) { 397 base::Time expiration) {
398 return SetAlternativeServices( 398 return SetAlternativeServices(
399 origin, 399 origin,
400 AlternativeServiceInfoVector( 400 AlternativeServiceInfoVector(
401 /*size=*/1, AlternativeServiceInfo(alternative_service, expiration))); 401 /*size=*/1, AlternativeServiceInfo(alternative_service, expiration)));
402 } 402 }
403 403
404 bool HttpServerPropertiesImpl::SetAlternativeServices( 404 bool HttpServerPropertiesImpl::SetAlternativeServices(
405 const HostPortPair& origin, 405 const url::SchemeHostPort& origin,
406 const AlternativeServiceInfoVector& alternative_service_info_vector) { 406 const AlternativeServiceInfoVector& alternative_service_info_vector) {
407 AlternativeServiceMap::iterator it = alternative_service_map_.Peek(origin); 407 AlternativeServiceMap::iterator it = alternative_service_map_.Peek(origin);
408 408
409 if (alternative_service_info_vector.empty()) { 409 if (alternative_service_info_vector.empty()) {
410 if (it == alternative_service_map_.end()) { 410 if (it == alternative_service_map_.end()) {
411 return false; 411 return false;
412 } 412 }
413 ClearAlternativeServices(origin); 413 ClearAlternativeServices(origin);
414 return true; 414 return true;
415 } 415 }
(...skipping 17 matching lines...) Expand all
433 // TODO(rch): Consider the case where multiple requests are started 433 // TODO(rch): Consider the case where multiple requests are started
434 // before the first completes. In this case, only one of the jobs 434 // before the first completes. In this case, only one of the jobs
435 // would reach this code, whereas all of them should should have. 435 // would reach this code, whereas all of them should should have.
436 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_MAPPING_MISSING); 436 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_MAPPING_MISSING);
437 } 437 }
438 438
439 // If this host ends with a canonical suffix, then set it as the 439 // If this host ends with a canonical suffix, then set it as the
440 // canonical host. 440 // canonical host.
441 for (size_t i = 0; i < canonical_suffixes_.size(); ++i) { 441 for (size_t i = 0; i < canonical_suffixes_.size(); ++i) {
442 std::string canonical_suffix = canonical_suffixes_[i]; 442 std::string canonical_suffix = canonical_suffixes_[i];
443 if (base::EndsWith(origin.host(), canonical_suffixes_[i], 443 // canonical suffixes only apply to HTTPS.
444 if (origin.scheme() == "https" &&
445 base::EndsWith(origin.host(), canonical_suffixes_[i],
444 base::CompareCase::INSENSITIVE_ASCII)) { 446 base::CompareCase::INSENSITIVE_ASCII)) {
445 HostPortPair canonical_host(canonical_suffix, origin.port()); 447 url::SchemeHostPort canonical_host("https", canonical_suffix,
448 origin.port());
446 canonical_host_to_origin_map_[canonical_host] = origin; 449 canonical_host_to_origin_map_[canonical_host] = origin;
447 break; 450 break;
448 } 451 }
449 } 452 }
450 453
451 return changed; 454 return changed;
452 } 455 }
453 456
454 void HttpServerPropertiesImpl::MarkAlternativeServiceBroken( 457 void HttpServerPropertiesImpl::MarkAlternativeServiceBroken(
455 const AlternativeService& alternative_service) { 458 const AlternativeService& alternative_service) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 503
501 void HttpServerPropertiesImpl::ConfirmAlternativeService( 504 void HttpServerPropertiesImpl::ConfirmAlternativeService(
502 const AlternativeService& alternative_service) { 505 const AlternativeService& alternative_service) {
503 if (alternative_service.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) 506 if (alternative_service.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL)
504 return; 507 return;
505 broken_alternative_services_.erase(alternative_service); 508 broken_alternative_services_.erase(alternative_service);
506 recently_broken_alternative_services_.erase(alternative_service); 509 recently_broken_alternative_services_.erase(alternative_service);
507 } 510 }
508 511
509 void HttpServerPropertiesImpl::ClearAlternativeServices( 512 void HttpServerPropertiesImpl::ClearAlternativeServices(
510 const HostPortPair& origin) { 513 const url::SchemeHostPort& origin) {
511 RemoveCanonicalHost(origin); 514 RemoveCanonicalHost(origin);
512 515
513 AlternativeServiceMap::iterator it = alternative_service_map_.Peek(origin); 516 AlternativeServiceMap::iterator it = alternative_service_map_.Peek(origin);
514 if (it == alternative_service_map_.end()) { 517 if (it == alternative_service_map_.end()) {
515 return; 518 return;
516 } 519 }
517 alternative_service_map_.Erase(it); 520 alternative_service_map_.Erase(it);
518 } 521 }
519 522
520 const AlternativeServiceMap& HttpServerPropertiesImpl::alternative_service_map() 523 const AlternativeServiceMap& HttpServerPropertiesImpl::alternative_service_map()
521 const { 524 const {
522 return alternative_service_map_; 525 return alternative_service_map_;
523 } 526 }
524 527
525 scoped_ptr<base::Value> 528 scoped_ptr<base::Value>
526 HttpServerPropertiesImpl::GetAlternativeServiceInfoAsValue() 529 HttpServerPropertiesImpl::GetAlternativeServiceInfoAsValue()
527 const { 530 const {
528 scoped_ptr<base::ListValue> dict_list(new base::ListValue); 531 scoped_ptr<base::ListValue> dict_list(new base::ListValue);
529 for (const auto& alternative_service_map_item : alternative_service_map_) { 532 for (const auto& alternative_service_map_item : alternative_service_map_) {
530 scoped_ptr<base::ListValue> alternative_service_list(new base::ListValue); 533 scoped_ptr<base::ListValue> alternative_service_list(new base::ListValue);
531 const HostPortPair& host_port_pair = alternative_service_map_item.first; 534 const url::SchemeHostPort& server = alternative_service_map_item.first;
532 for (const AlternativeServiceInfo& alternative_service_info : 535 for (const AlternativeServiceInfo& alternative_service_info :
533 alternative_service_map_item.second) { 536 alternative_service_map_item.second) {
534 std::string alternative_service_string( 537 std::string alternative_service_string(
535 alternative_service_info.ToString()); 538 alternative_service_info.ToString());
536 AlternativeService alternative_service( 539 AlternativeService alternative_service(
537 alternative_service_info.alternative_service); 540 alternative_service_info.alternative_service);
538 if (alternative_service.host.empty()) { 541 if (alternative_service.host.empty()) {
539 alternative_service.host = host_port_pair.host(); 542 alternative_service.host = server.host();
540 } 543 }
541 if (IsAlternativeServiceBroken(alternative_service)) { 544 if (IsAlternativeServiceBroken(alternative_service)) {
542 alternative_service_string.append(" (broken)"); 545 alternative_service_string.append(" (broken)");
543 } 546 }
544 alternative_service_list->Append( 547 alternative_service_list->Append(
545 new base::StringValue(alternative_service_string)); 548 new base::StringValue(alternative_service_string));
546 } 549 }
547 if (alternative_service_list->empty()) 550 if (alternative_service_list->empty())
548 continue; 551 continue;
549 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 552 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
550 dict->SetString("host_port_pair", host_port_pair.ToString()); 553 dict->SetString("server", server.Serialize());
551 dict->Set("alternative_service", 554 dict->Set("alternative_service",
552 scoped_ptr<base::Value>(std::move(alternative_service_list))); 555 scoped_ptr<base::Value>(std::move(alternative_service_list)));
553 dict_list->Append(std::move(dict)); 556 dict_list->Append(std::move(dict));
554 } 557 }
555 return std::move(dict_list); 558 return std::move(dict_list);
556 } 559 }
557 560
558 const SettingsMap& HttpServerPropertiesImpl::GetSpdySettings( 561 const SettingsMap& HttpServerPropertiesImpl::GetSpdySettings(
559 const url::SchemeHostPort& server) { 562 const url::SchemeHostPort& server) {
560 SpdySettingsMap::iterator it = spdy_settings_map_.Get(server); 563 SpdySettingsMap::iterator it = spdy_settings_map_.Get(server);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 for (QuicServerInfoMap::reverse_iterator it = quic_server_info_map_.rbegin(); 681 for (QuicServerInfoMap::reverse_iterator it = quic_server_info_map_.rbegin();
679 it != quic_server_info_map_.rend(); ++it) { 682 it != quic_server_info_map_.rend(); ++it) {
680 temp_map.Put(it->first, it->second); 683 temp_map.Put(it->first, it->second);
681 } 684 }
682 685
683 quic_server_info_map_.Swap(temp_map); 686 quic_server_info_map_.Swap(temp_map);
684 } 687 }
685 688
686 AlternativeServiceMap::const_iterator 689 AlternativeServiceMap::const_iterator
687 HttpServerPropertiesImpl::GetAlternateProtocolIterator( 690 HttpServerPropertiesImpl::GetAlternateProtocolIterator(
688 const HostPortPair& server) { 691 const url::SchemeHostPort& server) {
689 AlternativeServiceMap::const_iterator it = 692 AlternativeServiceMap::const_iterator it =
690 alternative_service_map_.Get(server); 693 alternative_service_map_.Get(server);
691 if (it != alternative_service_map_.end()) 694 if (it != alternative_service_map_.end())
692 return it; 695 return it;
693 696
694 CanonicalHostMap::const_iterator canonical = GetCanonicalHost(server); 697 CanonicalHostMap::const_iterator canonical = GetCanonicalHost(server);
695 if (canonical == canonical_host_to_origin_map_.end()) { 698 if (canonical == canonical_host_to_origin_map_.end()) {
696 return alternative_service_map_.end(); 699 return alternative_service_map_.end();
697 } 700 }
698 701
699 const HostPortPair canonical_host_port = canonical->second; 702 const url::SchemeHostPort canonical_server = canonical->second;
700 it = alternative_service_map_.Get(canonical_host_port); 703 it = alternative_service_map_.Get(canonical_server);
701 if (it == alternative_service_map_.end()) { 704 if (it == alternative_service_map_.end()) {
702 return alternative_service_map_.end(); 705 return alternative_service_map_.end();
703 } 706 }
704 707
705 for (const AlternativeServiceInfo& alternative_service_info : it->second) { 708 for (const AlternativeServiceInfo& alternative_service_info : it->second) {
706 AlternativeService alternative_service( 709 AlternativeService alternative_service(
707 alternative_service_info.alternative_service); 710 alternative_service_info.alternative_service);
708 if (alternative_service.host.empty()) { 711 if (alternative_service.host.empty()) {
709 alternative_service.host = canonical_host_port.host(); 712 alternative_service.host = canonical_server.host();
710 } 713 }
711 if (!IsAlternativeServiceBroken(alternative_service)) { 714 if (!IsAlternativeServiceBroken(alternative_service)) {
712 return it; 715 return it;
713 } 716 }
714 } 717 }
715 718
716 RemoveCanonicalHost(canonical_host_port); 719 RemoveCanonicalHost(canonical_server);
717 return alternative_service_map_.end(); 720 return alternative_service_map_.end();
718 } 721 }
719 722
720 HttpServerPropertiesImpl::CanonicalHostMap::const_iterator 723 HttpServerPropertiesImpl::CanonicalHostMap::const_iterator
721 HttpServerPropertiesImpl::GetCanonicalHost(HostPortPair server) const { 724 HttpServerPropertiesImpl::GetCanonicalHost(
725 const url::SchemeHostPort& server) const {
726 if (server.scheme() != "https")
727 return canonical_host_to_origin_map_.end();
728
722 for (size_t i = 0; i < canonical_suffixes_.size(); ++i) { 729 for (size_t i = 0; i < canonical_suffixes_.size(); ++i) {
723 std::string canonical_suffix = canonical_suffixes_[i]; 730 std::string canonical_suffix = canonical_suffixes_[i];
724 if (base::EndsWith(server.host(), canonical_suffixes_[i], 731 if (base::EndsWith(server.host(), canonical_suffixes_[i],
725 base::CompareCase::INSENSITIVE_ASCII)) { 732 base::CompareCase::INSENSITIVE_ASCII)) {
726 HostPortPair canonical_host(canonical_suffix, server.port()); 733 url::SchemeHostPort canonical_host("https", canonical_suffix,
734 server.port());
727 return canonical_host_to_origin_map_.find(canonical_host); 735 return canonical_host_to_origin_map_.find(canonical_host);
728 } 736 }
729 } 737 }
730 738
731 return canonical_host_to_origin_map_.end(); 739 return canonical_host_to_origin_map_.end();
732 } 740 }
733 741
734 void HttpServerPropertiesImpl::RemoveCanonicalHost( 742 void HttpServerPropertiesImpl::RemoveCanonicalHost(
735 const HostPortPair& server) { 743 const url::SchemeHostPort& server) {
736 CanonicalHostMap::const_iterator canonical = GetCanonicalHost(server); 744 CanonicalHostMap::const_iterator canonical = GetCanonicalHost(server);
737 if (canonical == canonical_host_to_origin_map_.end()) 745 if (canonical == canonical_host_to_origin_map_.end())
738 return; 746 return;
739 747
740 if (!canonical->second.Equals(server)) 748 if (!canonical->second.Equals(server))
741 return; 749 return;
742 750
743 canonical_host_to_origin_map_.erase(canonical->first); 751 canonical_host_to_origin_map_.erase(canonical->first);
744 } 752 }
745 753
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); 806 base::TimeDelta delay = when > now ? when - now : base::TimeDelta();
799 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 807 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
800 FROM_HERE, 808 FROM_HERE,
801 base::Bind( 809 base::Bind(
802 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, 810 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings,
803 weak_ptr_factory_.GetWeakPtr()), 811 weak_ptr_factory_.GetWeakPtr()),
804 delay); 812 delay);
805 } 813 }
806 814
807 } // namespace net 815 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698