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

Unified Diff: net/base/host_resolver_impl.cc

Issue 9721002: [net/dns] Removes locking from DnsConfigServiceWin and adds local computer name. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Move lowercasing to ServeFromHosts, add test. Reorganize OnHostsRead. Created 8 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 | net/base/host_resolver_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/host_resolver_impl.cc
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
index c1b7a3fc07827e10b69334d7ed91bf0441e6a1e8..73a3d1291e51706114df71e46124fc70be6a7f1b 100644
--- a/net/base/host_resolver_impl.cc
+++ b/net/base/host_resolver_impl.cc
@@ -1722,7 +1722,6 @@ bool HostResolverImpl::ServeFromCache(const Key& key,
if (!cache_entry)
return false;
-
*net_error = cache_entry->error;
if (*net_error == OK)
*addresses = CreateAddressListUsingPort(cache_entry->addrlist, info.port());
@@ -1736,13 +1735,16 @@ bool HostResolverImpl::ServeFromHosts(const Key& key,
if (!HaveDnsConfig())
return false;
+ // HOSTS lookups are case-insensitive.
+ std::string hostname = StringToLowerASCII(key.hostname);
+
// If |address_family| is ADDRESS_FAMILY_UNSPECIFIED other implementations
// (glibc and c-ares) return the first matching line. We have more
// flexibility, but lose implicit ordering.
// TODO(szym) http://crbug.com/117850
const DnsHosts& hosts = dns_client_->GetConfig()->hosts;
DnsHosts::const_iterator it = hosts.find(
- DnsHostsKey(key.hostname,
+ DnsHostsKey(hostname,
key.address_family == ADDRESS_FAMILY_UNSPECIFIED ?
ADDRESS_FAMILY_IPV4 : key.address_family));
@@ -1750,7 +1752,7 @@ bool HostResolverImpl::ServeFromHosts(const Key& key,
if (key.address_family != ADDRESS_FAMILY_UNSPECIFIED)
return false;
- it = hosts.find(DnsHostsKey(key.hostname, ADDRESS_FAMILY_IPV6));
+ it = hosts.find(DnsHostsKey(hostname, ADDRESS_FAMILY_IPV6));
if (it == hosts.end())
return false;
}
« no previous file with comments | « no previous file | net/base/host_resolver_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698