| OLD | NEW |
| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // Add the entries from the memory cache. | 97 // Add the entries from the memory cache. |
| 98 for (AlternativeServiceMap::reverse_iterator input_it = | 98 for (AlternativeServiceMap::reverse_iterator input_it = |
| 99 new_alternative_service_map.rbegin(); | 99 new_alternative_service_map.rbegin(); |
| 100 input_it != new_alternative_service_map.rend(); ++input_it) { | 100 input_it != new_alternative_service_map.rend(); ++input_it) { |
| 101 if (alternative_service_map_.Get(input_it->first) == | 101 if (alternative_service_map_.Get(input_it->first) == |
| 102 alternative_service_map_.end()) { | 102 alternative_service_map_.end()) { |
| 103 alternative_service_map_.Put(input_it->first, input_it->second); | 103 alternative_service_map_.Put(input_it->first, input_it->second); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 // Attempt to find canonical servers. | 107 // Attempt to find canonical servers. Canonical suffixes only apply to HTTPS. |
| 108 uint16_t canonical_ports[] = {80, 443}; | 108 uint16_t canonical_ports = 443; |
| 109 for (size_t i = 0; i < canonical_suffixes_.size(); ++i) { | 109 for (size_t i = 0; i < canonical_suffixes_.size(); ++i) { |
| 110 std::string canonical_suffix = canonical_suffixes_[i]; | 110 std::string canonical_suffix = canonical_suffixes_[i]; |
| 111 for (size_t j = 0; j < arraysize(canonical_ports); ++j) { | 111 url::SchemeHostPort canonical_host("https", canonical_suffix, |
| 112 HostPortPair canonical_host(canonical_suffix, canonical_ports[j]); | 112 canonical_ports); |
| 113 // If we already have a valid canonical server, we're done. | 113 // If we already have a valid canonical server, we're done. |
| 114 if (ContainsKey(canonical_host_to_origin_map_, canonical_host) && | 114 if (ContainsKey(canonical_host_to_origin_map_, canonical_host) && |
| 115 (alternative_service_map_.Peek( | 115 (alternative_service_map_.Peek( |
| 116 canonical_host_to_origin_map_[canonical_host]) != | 116 canonical_host_to_origin_map_[canonical_host]) != |
| 117 alternative_service_map_.end())) { | 117 alternative_service_map_.end())) { |
| 118 continue; | 118 continue; |
| 119 } | 119 } |
| 120 // Now attempt to find a server which matches this origin and set it as | 120 // Now attempt to find a server which matches this origin and set it as |
| 121 // canonical. | 121 // canonical. |
| 122 for (AlternativeServiceMap::const_iterator it = | 122 for (AlternativeServiceMap::const_iterator it = |
| 123 alternative_service_map_.begin(); | 123 alternative_service_map_.begin(); |
| 124 it != alternative_service_map_.end(); ++it) { | 124 it != alternative_service_map_.end(); ++it) { |
| 125 if (base::EndsWith(it->first.host(), canonical_suffixes_[i], | 125 if (base::EndsWith(it->first.host(), canonical_suffixes_[i], |
| 126 base::CompareCase::INSENSITIVE_ASCII)) { | 126 base::CompareCase::INSENSITIVE_ASCII) && |
| 127 canonical_host_to_origin_map_[canonical_host] = it->first; | 127 it->first.scheme() == "https") { |
| 128 break; | 128 canonical_host_to_origin_map_[canonical_host] = it->first; |
| 129 } | 129 break; |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 void HttpServerPropertiesImpl::InitializeSpdySettingsServers( | 135 void HttpServerPropertiesImpl::InitializeSpdySettingsServers( |
| 136 SpdySettingsMap* spdy_settings_map) { | 136 SpdySettingsMap* spdy_settings_map) { |
| 137 // Add the entries from persisted data. | 137 // Add the entries from persisted data. |
| 138 SpdySettingsMap new_spdy_settings_map(SpdySettingsMap::NO_AUTO_EVICT); | 138 SpdySettingsMap new_spdy_settings_map(SpdySettingsMap::NO_AUTO_EVICT); |
| 139 for (SpdySettingsMap::reverse_iterator it = spdy_settings_map->rbegin(); | 139 for (SpdySettingsMap::reverse_iterator it = spdy_settings_map->rbegin(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 spdy_servers_map_.Clear(); | 227 spdy_servers_map_.Clear(); |
| 228 alternative_service_map_.Clear(); | 228 alternative_service_map_.Clear(); |
| 229 canonical_host_to_origin_map_.clear(); | 229 canonical_host_to_origin_map_.clear(); |
| 230 spdy_settings_map_.Clear(); | 230 spdy_settings_map_.Clear(); |
| 231 last_quic_address_ = IPAddress(); | 231 last_quic_address_ = IPAddress(); |
| 232 server_network_stats_map_.Clear(); | 232 server_network_stats_map_.Clear(); |
| 233 quic_server_info_map_.Clear(); | 233 quic_server_info_map_.Clear(); |
| 234 } | 234 } |
| 235 | 235 |
| 236 bool HttpServerPropertiesImpl::SupportsRequestPriority( | 236 bool HttpServerPropertiesImpl::SupportsRequestPriority( |
| 237 const HostPortPair& host_port_pair) { | 237 const url::SchemeHostPort& server) { |
| 238 DCHECK(CalledOnValidThread()); | 238 DCHECK(CalledOnValidThread()); |
| 239 if (host_port_pair.host().empty()) | 239 if (server.host().empty()) |
| 240 return false; | 240 return false; |
| 241 | 241 if (GetSupportsSpdy(HostPortPair::FromSchemeHostPort(server))) |
| 242 if (GetSupportsSpdy(host_port_pair)) | |
| 243 return true; | 242 return true; |
| 244 | 243 |
| 245 const AlternativeServiceVector alternative_service_vector = | 244 const AlternativeServiceVector alternative_service_vector = |
| 246 GetAlternativeServices(host_port_pair); | 245 GetAlternativeServices(server); |
| 247 for (const AlternativeService& alternative_service : | 246 for (const AlternativeService& alternative_service : |
| 248 alternative_service_vector) { | 247 alternative_service_vector) { |
| 249 if (alternative_service.protocol == QUIC) { | 248 if (alternative_service.protocol == QUIC) { |
| 250 return true; | 249 return true; |
| 251 } | 250 } |
| 252 } | 251 } |
| 253 return false; | 252 return false; |
| 254 } | 253 } |
| 255 | 254 |
| 256 bool HttpServerPropertiesImpl::GetSupportsSpdy( | 255 bool HttpServerPropertiesImpl::GetSupportsSpdy( |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 std::string canonical_suffix = canonical_suffixes_[i]; | 313 std::string canonical_suffix = canonical_suffixes_[i]; |
| 315 if (base::EndsWith(host, canonical_suffixes_[i], | 314 if (base::EndsWith(host, canonical_suffixes_[i], |
| 316 base::CompareCase::INSENSITIVE_ASCII)) { | 315 base::CompareCase::INSENSITIVE_ASCII)) { |
| 317 return canonical_suffix; | 316 return canonical_suffix; |
| 318 } | 317 } |
| 319 } | 318 } |
| 320 return std::string(); | 319 return std::string(); |
| 321 } | 320 } |
| 322 | 321 |
| 323 AlternativeServiceVector HttpServerPropertiesImpl::GetAlternativeServices( | 322 AlternativeServiceVector HttpServerPropertiesImpl::GetAlternativeServices( |
| 324 const HostPortPair& origin) { | 323 const url::SchemeHostPort& origin) { |
| 325 // Copy valid alternative services into |valid_alternative_services|. | 324 // Copy valid alternative services into |valid_alternative_services|. |
| 326 AlternativeServiceVector valid_alternative_services; | 325 AlternativeServiceVector valid_alternative_services; |
| 327 const base::Time now = base::Time::Now(); | 326 const base::Time now = base::Time::Now(); |
| 328 AlternativeServiceMap::iterator map_it = alternative_service_map_.Get(origin); | 327 AlternativeServiceMap::iterator map_it = alternative_service_map_.Get(origin); |
| 329 if (map_it != alternative_service_map_.end()) { | 328 if (map_it != alternative_service_map_.end()) { |
| 330 for (AlternativeServiceInfoVector::iterator it = map_it->second.begin(); | 329 for (AlternativeServiceInfoVector::iterator it = map_it->second.begin(); |
| 331 it != map_it->second.end();) { | 330 it != map_it->second.end();) { |
| 332 if (it->expiration < now) { | 331 if (it->expiration < now) { |
| 333 it = map_it->second.erase(it); | 332 it = map_it->second.erase(it); |
| 334 continue; | 333 continue; |
| 335 } | 334 } |
| 336 AlternativeService alternative_service(it->alternative_service); | 335 AlternativeService alternative_service(it->alternative_service); |
| 337 if (alternative_service.host.empty()) { | 336 if (alternative_service.host.empty()) { |
| 338 alternative_service.host = origin.host(); | 337 alternative_service.host = origin.host(); |
| 339 } | 338 } |
| 340 // If the alternative service is equivalent to the origin (same host, same | 339 // If the alternative service is equivalent to the origin (same host, same |
| 341 // port, and both TCP), then there is already a Job for it, so do not | 340 // port, and both TCP), then there is already a Job for it, so do not |
| 342 // return it here. | 341 // return it here. |
| 343 if (origin.Equals(alternative_service.host_port_pair()) && | 342 if (HostPortPair::FromSchemeHostPort(origin).Equals( |
| 343 alternative_service.host_port_pair()) && |
| 344 NPN_SPDY_MINIMUM_VERSION <= alternative_service.protocol && | 344 NPN_SPDY_MINIMUM_VERSION <= alternative_service.protocol && |
| 345 alternative_service.protocol <= NPN_SPDY_MAXIMUM_VERSION) { | 345 alternative_service.protocol <= NPN_SPDY_MAXIMUM_VERSION) { |
| 346 ++it; | 346 ++it; |
| 347 continue; | 347 continue; |
| 348 } | 348 } |
| 349 valid_alternative_services.push_back(alternative_service); | 349 valid_alternative_services.push_back(alternative_service); |
| 350 ++it; | 350 ++it; |
| 351 } | 351 } |
| 352 if (map_it->second.empty()) { | 352 if (map_it->second.empty()) { |
| 353 alternative_service_map_.Erase(map_it); | 353 alternative_service_map_.Erase(map_it); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 384 valid_alternative_services.push_back(alternative_service); | 384 valid_alternative_services.push_back(alternative_service); |
| 385 ++it; | 385 ++it; |
| 386 } | 386 } |
| 387 if (map_it->second.empty()) { | 387 if (map_it->second.empty()) { |
| 388 alternative_service_map_.Erase(map_it); | 388 alternative_service_map_.Erase(map_it); |
| 389 } | 389 } |
| 390 return valid_alternative_services; | 390 return valid_alternative_services; |
| 391 } | 391 } |
| 392 | 392 |
| 393 bool HttpServerPropertiesImpl::SetAlternativeService( | 393 bool HttpServerPropertiesImpl::SetAlternativeService( |
| 394 const HostPortPair& origin, | 394 const url::SchemeHostPort& origin, |
| 395 const AlternativeService& alternative_service, | 395 const AlternativeService& alternative_service, |
| 396 base::Time expiration) { | 396 base::Time expiration) { |
| 397 return SetAlternativeServices( | 397 return SetAlternativeServices( |
| 398 origin, | 398 origin, |
| 399 AlternativeServiceInfoVector( | 399 AlternativeServiceInfoVector( |
| 400 /*size=*/1, AlternativeServiceInfo(alternative_service, expiration))); | 400 /*size=*/1, AlternativeServiceInfo(alternative_service, expiration))); |
| 401 } | 401 } |
| 402 | 402 |
| 403 bool HttpServerPropertiesImpl::SetAlternativeServices( | 403 bool HttpServerPropertiesImpl::SetAlternativeServices( |
| 404 const HostPortPair& origin, | 404 const url::SchemeHostPort& origin, |
| 405 const AlternativeServiceInfoVector& alternative_service_info_vector) { | 405 const AlternativeServiceInfoVector& alternative_service_info_vector) { |
| 406 AlternativeServiceMap::iterator it = alternative_service_map_.Peek(origin); | 406 AlternativeServiceMap::iterator it = alternative_service_map_.Peek(origin); |
| 407 | 407 |
| 408 if (alternative_service_info_vector.empty()) { | 408 if (alternative_service_info_vector.empty()) { |
| 409 if (it == alternative_service_map_.end()) { | 409 if (it == alternative_service_map_.end()) { |
| 410 return false; | 410 return false; |
| 411 } | 411 } |
| 412 ClearAlternativeServices(origin); | 412 ClearAlternativeServices(origin); |
| 413 return true; | 413 return true; |
| 414 } | 414 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 432 // TODO(rch): Consider the case where multiple requests are started | 432 // TODO(rch): Consider the case where multiple requests are started |
| 433 // before the first completes. In this case, only one of the jobs | 433 // before the first completes. In this case, only one of the jobs |
| 434 // would reach this code, whereas all of them should should have. | 434 // would reach this code, whereas all of them should should have. |
| 435 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_MAPPING_MISSING); | 435 HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_MAPPING_MISSING); |
| 436 } | 436 } |
| 437 | 437 |
| 438 // If this host ends with a canonical suffix, then set it as the | 438 // If this host ends with a canonical suffix, then set it as the |
| 439 // canonical host. | 439 // canonical host. |
| 440 for (size_t i = 0; i < canonical_suffixes_.size(); ++i) { | 440 for (size_t i = 0; i < canonical_suffixes_.size(); ++i) { |
| 441 std::string canonical_suffix = canonical_suffixes_[i]; | 441 std::string canonical_suffix = canonical_suffixes_[i]; |
| 442 if (base::EndsWith(origin.host(), canonical_suffixes_[i], | 442 // canonical suffixes only apply to HTTPS. |
| 443 if (origin.scheme() == "https" && |
| 444 base::EndsWith(origin.host(), canonical_suffixes_[i], |
| 443 base::CompareCase::INSENSITIVE_ASCII)) { | 445 base::CompareCase::INSENSITIVE_ASCII)) { |
| 444 HostPortPair canonical_host(canonical_suffix, origin.port()); | 446 url::SchemeHostPort canonical_host(origin.scheme(), canonical_suffix, |
| 447 origin.port()); |
| 445 canonical_host_to_origin_map_[canonical_host] = origin; | 448 canonical_host_to_origin_map_[canonical_host] = origin; |
| 446 break; | 449 break; |
| 447 } | 450 } |
| 448 } | 451 } |
| 449 | 452 |
| 450 return changed; | 453 return changed; |
| 451 } | 454 } |
| 452 | 455 |
| 453 void HttpServerPropertiesImpl::MarkAlternativeServiceBroken( | 456 void HttpServerPropertiesImpl::MarkAlternativeServiceBroken( |
| 454 const AlternativeService& alternative_service) { | 457 const AlternativeService& alternative_service) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 | 502 |
| 500 void HttpServerPropertiesImpl::ConfirmAlternativeService( | 503 void HttpServerPropertiesImpl::ConfirmAlternativeService( |
| 501 const AlternativeService& alternative_service) { | 504 const AlternativeService& alternative_service) { |
| 502 if (alternative_service.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) | 505 if (alternative_service.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) |
| 503 return; | 506 return; |
| 504 broken_alternative_services_.erase(alternative_service); | 507 broken_alternative_services_.erase(alternative_service); |
| 505 recently_broken_alternative_services_.erase(alternative_service); | 508 recently_broken_alternative_services_.erase(alternative_service); |
| 506 } | 509 } |
| 507 | 510 |
| 508 void HttpServerPropertiesImpl::ClearAlternativeServices( | 511 void HttpServerPropertiesImpl::ClearAlternativeServices( |
| 509 const HostPortPair& origin) { | 512 const url::SchemeHostPort& origin) { |
| 510 RemoveCanonicalHost(origin); | 513 RemoveCanonicalHost(origin); |
| 511 | 514 |
| 512 AlternativeServiceMap::iterator it = alternative_service_map_.Peek(origin); | 515 AlternativeServiceMap::iterator it = alternative_service_map_.Peek(origin); |
| 513 if (it == alternative_service_map_.end()) { | 516 if (it == alternative_service_map_.end()) { |
| 514 return; | 517 return; |
| 515 } | 518 } |
| 516 alternative_service_map_.Erase(it); | 519 alternative_service_map_.Erase(it); |
| 517 } | 520 } |
| 518 | 521 |
| 519 const AlternativeServiceMap& HttpServerPropertiesImpl::alternative_service_map() | 522 const AlternativeServiceMap& HttpServerPropertiesImpl::alternative_service_map() |
| 520 const { | 523 const { |
| 521 return alternative_service_map_; | 524 return alternative_service_map_; |
| 522 } | 525 } |
| 523 | 526 |
| 524 scoped_ptr<base::Value> | 527 scoped_ptr<base::Value> |
| 525 HttpServerPropertiesImpl::GetAlternativeServiceInfoAsValue() | 528 HttpServerPropertiesImpl::GetAlternativeServiceInfoAsValue() |
| 526 const { | 529 const { |
| 527 scoped_ptr<base::ListValue> dict_list(new base::ListValue); | 530 scoped_ptr<base::ListValue> dict_list(new base::ListValue); |
| 528 for (const auto& alternative_service_map_item : alternative_service_map_) { | 531 for (const auto& alternative_service_map_item : alternative_service_map_) { |
| 529 scoped_ptr<base::ListValue> alternative_service_list(new base::ListValue); | 532 scoped_ptr<base::ListValue> alternative_service_list(new base::ListValue); |
| 530 const HostPortPair& host_port_pair = alternative_service_map_item.first; | 533 const HostPortPair& host_port_pair = |
| 534 HostPortPair::FromSchemeHostPort(alternative_service_map_item.first); |
| 531 for (const AlternativeServiceInfo& alternative_service_info : | 535 for (const AlternativeServiceInfo& alternative_service_info : |
| 532 alternative_service_map_item.second) { | 536 alternative_service_map_item.second) { |
| 533 std::string alternative_service_string( | 537 std::string alternative_service_string( |
| 534 alternative_service_info.ToString()); | 538 alternative_service_info.ToString()); |
| 535 AlternativeService alternative_service( | 539 AlternativeService alternative_service( |
| 536 alternative_service_info.alternative_service); | 540 alternative_service_info.alternative_service); |
| 537 if (alternative_service.host.empty()) { | 541 if (alternative_service.host.empty()) { |
| 538 alternative_service.host = host_port_pair.host(); | 542 alternative_service.host = host_port_pair.host(); |
| 539 } | 543 } |
| 540 if (IsAlternativeServiceBroken(alternative_service)) { | 544 if (IsAlternativeServiceBroken(alternative_service)) { |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 for (QuicServerInfoMap::reverse_iterator it = quic_server_info_map_.rbegin(); | 683 for (QuicServerInfoMap::reverse_iterator it = quic_server_info_map_.rbegin(); |
| 680 it != quic_server_info_map_.rend(); ++it) { | 684 it != quic_server_info_map_.rend(); ++it) { |
| 681 temp_map.Put(it->first, it->second); | 685 temp_map.Put(it->first, it->second); |
| 682 } | 686 } |
| 683 | 687 |
| 684 quic_server_info_map_.Swap(temp_map); | 688 quic_server_info_map_.Swap(temp_map); |
| 685 } | 689 } |
| 686 | 690 |
| 687 AlternativeServiceMap::const_iterator | 691 AlternativeServiceMap::const_iterator |
| 688 HttpServerPropertiesImpl::GetAlternateProtocolIterator( | 692 HttpServerPropertiesImpl::GetAlternateProtocolIterator( |
| 689 const HostPortPair& server) { | 693 const url::SchemeHostPort& server) { |
| 690 AlternativeServiceMap::const_iterator it = | 694 AlternativeServiceMap::const_iterator it = |
| 691 alternative_service_map_.Get(server); | 695 alternative_service_map_.Get(server); |
| 692 if (it != alternative_service_map_.end()) | 696 if (it != alternative_service_map_.end()) |
| 693 return it; | 697 return it; |
| 694 | 698 |
| 699 if (server.scheme() != "https") |
| 700 return alternative_service_map_.end(); |
| 701 |
| 695 CanonicalHostMap::const_iterator canonical = GetCanonicalHost(server); | 702 CanonicalHostMap::const_iterator canonical = GetCanonicalHost(server); |
| 696 if (canonical == canonical_host_to_origin_map_.end()) { | 703 if (canonical == canonical_host_to_origin_map_.end()) { |
| 697 return alternative_service_map_.end(); | 704 return alternative_service_map_.end(); |
| 698 } | 705 } |
| 699 | 706 |
| 700 const HostPortPair canonical_host_port = canonical->second; | 707 const url::SchemeHostPort canonical_scheme_host_port = canonical->second; |
| 701 it = alternative_service_map_.Get(canonical_host_port); | 708 it = alternative_service_map_.Get(canonical_scheme_host_port); |
| 702 if (it == alternative_service_map_.end()) { | 709 if (it == alternative_service_map_.end()) { |
| 703 return alternative_service_map_.end(); | 710 return alternative_service_map_.end(); |
| 704 } | 711 } |
| 705 | 712 |
| 706 for (const AlternativeServiceInfo& alternative_service_info : it->second) { | 713 for (const AlternativeServiceInfo& alternative_service_info : it->second) { |
| 707 AlternativeService alternative_service( | 714 AlternativeService alternative_service( |
| 708 alternative_service_info.alternative_service); | 715 alternative_service_info.alternative_service); |
| 709 if (alternative_service.host.empty()) { | 716 if (alternative_service.host.empty()) { |
| 710 alternative_service.host = canonical_host_port.host(); | 717 alternative_service.host = canonical_scheme_host_port.host(); |
| 711 } | 718 } |
| 712 if (!IsAlternativeServiceBroken(alternative_service)) { | 719 if (!IsAlternativeServiceBroken(alternative_service)) { |
| 713 return it; | 720 return it; |
| 714 } | 721 } |
| 715 } | 722 } |
| 716 | 723 |
| 717 RemoveCanonicalHost(canonical_host_port); | 724 RemoveCanonicalHost(canonical_scheme_host_port); |
| 718 return alternative_service_map_.end(); | 725 return alternative_service_map_.end(); |
| 719 } | 726 } |
| 720 | 727 |
| 721 HttpServerPropertiesImpl::CanonicalHostMap::const_iterator | 728 HttpServerPropertiesImpl::CanonicalHostMap::const_iterator |
| 722 HttpServerPropertiesImpl::GetCanonicalHost(HostPortPair server) const { | 729 HttpServerPropertiesImpl::GetCanonicalHost(url::SchemeHostPort server) const { |
| 723 for (size_t i = 0; i < canonical_suffixes_.size(); ++i) { | 730 for (size_t i = 0; i < canonical_suffixes_.size(); ++i) { |
| 724 std::string canonical_suffix = canonical_suffixes_[i]; | 731 std::string canonical_suffix = canonical_suffixes_[i]; |
| 725 if (base::EndsWith(server.host(), canonical_suffixes_[i], | 732 if (base::EndsWith(server.host(), canonical_suffixes_[i], |
| 726 base::CompareCase::INSENSITIVE_ASCII)) { | 733 base::CompareCase::INSENSITIVE_ASCII)) { |
| 727 HostPortPair canonical_host(canonical_suffix, server.port()); | 734 url::SchemeHostPort canonical_origin(server.scheme(), canonical_suffix, |
| 728 return canonical_host_to_origin_map_.find(canonical_host); | 735 server.port()); |
| 736 return canonical_host_to_origin_map_.find(canonical_origin); |
| 729 } | 737 } |
| 730 } | 738 } |
| 731 | 739 |
| 732 return canonical_host_to_origin_map_.end(); | 740 return canonical_host_to_origin_map_.end(); |
| 733 } | 741 } |
| 734 | 742 |
| 735 void HttpServerPropertiesImpl::RemoveCanonicalHost( | 743 void HttpServerPropertiesImpl::RemoveCanonicalHost( |
| 736 const HostPortPair& server) { | 744 const url::SchemeHostPort& server) { |
| 737 CanonicalHostMap::const_iterator canonical = GetCanonicalHost(server); | 745 CanonicalHostMap::const_iterator canonical = GetCanonicalHost(server); |
| 738 if (canonical == canonical_host_to_origin_map_.end()) | 746 if (canonical == canonical_host_to_origin_map_.end()) |
| 739 return; | 747 return; |
| 740 | 748 |
| 741 if (!canonical->second.Equals(server)) | 749 if (!canonical->second.Equals(server)) |
| 742 return; | 750 return; |
| 743 | 751 |
| 744 canonical_host_to_origin_map_.erase(canonical->first); | 752 canonical_host_to_origin_map_.erase(canonical->first); |
| 745 } | 753 } |
| 746 | 754 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); | 807 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); |
| 800 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 808 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 801 FROM_HERE, | 809 FROM_HERE, |
| 802 base::Bind( | 810 base::Bind( |
| 803 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, | 811 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, |
| 804 weak_ptr_factory_.GetWeakPtr()), | 812 weak_ptr_factory_.GetWeakPtr()), |
| 805 delay); | 813 delay); |
| 806 } | 814 } |
| 807 | 815 |
| 808 } // namespace net | 816 } // namespace net |
| OLD | NEW |