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 2059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2070 | 2070 |
2071 bool HostResolverImpl::ServeFromHosts(const Key& key, | 2071 bool HostResolverImpl::ServeFromHosts(const Key& key, |
2072 const RequestInfo& info, | 2072 const RequestInfo& info, |
2073 AddressList* addresses) { | 2073 AddressList* addresses) { |
2074 DCHECK(addresses); | 2074 DCHECK(addresses); |
2075 if (!HaveDnsConfig()) | 2075 if (!HaveDnsConfig()) |
2076 return false; | 2076 return false; |
2077 addresses->clear(); | 2077 addresses->clear(); |
2078 | 2078 |
2079 // HOSTS lookups are case-insensitive. | 2079 // HOSTS lookups are case-insensitive. |
2080 std::string hostname = StringToLowerASCII(key.hostname); | 2080 std::string hostname = base::StringToLowerASCII(key.hostname); |
2081 | 2081 |
2082 const DnsHosts& hosts = dns_client_->GetConfig()->hosts; | 2082 const DnsHosts& hosts = dns_client_->GetConfig()->hosts; |
2083 | 2083 |
2084 // If |address_family| is ADDRESS_FAMILY_UNSPECIFIED other implementations | 2084 // If |address_family| is ADDRESS_FAMILY_UNSPECIFIED other implementations |
2085 // (glibc and c-ares) return the first matching line. We have more | 2085 // (glibc and c-ares) return the first matching line. We have more |
2086 // flexibility, but lose implicit ordering. | 2086 // flexibility, but lose implicit ordering. |
2087 // We prefer IPv6 because "happy eyeballs" will fall back to IPv4 if | 2087 // We prefer IPv6 because "happy eyeballs" will fall back to IPv4 if |
2088 // necessary. | 2088 // necessary. |
2089 if (key.address_family == ADDRESS_FAMILY_IPV6 || | 2089 if (key.address_family == ADDRESS_FAMILY_IPV6 || |
2090 key.address_family == ADDRESS_FAMILY_UNSPECIFIED) { | 2090 key.address_family == ADDRESS_FAMILY_UNSPECIFIED) { |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2350 dns_client_->SetConfig(dns_config); | 2350 dns_client_->SetConfig(dns_config); |
2351 num_dns_failures_ = 0; | 2351 num_dns_failures_ = 0; |
2352 if (dns_client_->GetConfig()) | 2352 if (dns_client_->GetConfig()) |
2353 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); | 2353 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); |
2354 } | 2354 } |
2355 | 2355 |
2356 AbortDnsTasks(); | 2356 AbortDnsTasks(); |
2357 } | 2357 } |
2358 | 2358 |
2359 } // namespace net | 2359 } // namespace net |
OLD | NEW |