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/dns/host_resolver_impl.h" | 5 #include "net/dns/host_resolver_impl.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <Winsock2.h> | 8 #include <Winsock2.h> |
9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
10 #include <netdb.h> | 10 #include <netdb.h> |
(...skipping 2100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2111 | 2111 |
2112 bool HostResolverImpl::ServeFromHosts(const Key& key, | 2112 bool HostResolverImpl::ServeFromHosts(const Key& key, |
2113 const RequestInfo& info, | 2113 const RequestInfo& info, |
2114 AddressList* addresses) { | 2114 AddressList* addresses) { |
2115 DCHECK(addresses); | 2115 DCHECK(addresses); |
2116 if (!HaveDnsConfig()) | 2116 if (!HaveDnsConfig()) |
2117 return false; | 2117 return false; |
2118 addresses->clear(); | 2118 addresses->clear(); |
2119 | 2119 |
2120 // HOSTS lookups are case-insensitive. | 2120 // HOSTS lookups are case-insensitive. |
2121 std::string hostname = base::StringToLowerASCII(key.hostname); | 2121 std::string hostname = base::ToLowerASCII(key.hostname); |
2122 | 2122 |
2123 const DnsHosts& hosts = dns_client_->GetConfig()->hosts; | 2123 const DnsHosts& hosts = dns_client_->GetConfig()->hosts; |
2124 | 2124 |
2125 // If |address_family| is ADDRESS_FAMILY_UNSPECIFIED other implementations | 2125 // If |address_family| is ADDRESS_FAMILY_UNSPECIFIED other implementations |
2126 // (glibc and c-ares) return the first matching line. We have more | 2126 // (glibc and c-ares) return the first matching line. We have more |
2127 // flexibility, but lose implicit ordering. | 2127 // flexibility, but lose implicit ordering. |
2128 // We prefer IPv6 because "happy eyeballs" will fall back to IPv4 if | 2128 // We prefer IPv6 because "happy eyeballs" will fall back to IPv4 if |
2129 // necessary. | 2129 // necessary. |
2130 if (key.address_family == ADDRESS_FAMILY_IPV6 || | 2130 if (key.address_family == ADDRESS_FAMILY_IPV6 || |
2131 key.address_family == ADDRESS_FAMILY_UNSPECIFIED) { | 2131 key.address_family == ADDRESS_FAMILY_UNSPECIFIED) { |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2433 dns_client_->SetConfig(dns_config); | 2433 dns_client_->SetConfig(dns_config); |
2434 num_dns_failures_ = 0; | 2434 num_dns_failures_ = 0; |
2435 if (dns_client_->GetConfig()) | 2435 if (dns_client_->GetConfig()) |
2436 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); | 2436 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); |
2437 } | 2437 } |
2438 | 2438 |
2439 AbortDnsTasks(); | 2439 AbortDnsTasks(); |
2440 } | 2440 } |
2441 | 2441 |
2442 } // namespace net | 2442 } // namespace net |
OLD | NEW |