Chromium Code Reviews

Unified Diff: net/base/host_resolver_proc.cc

Issue 1593015: HostResolver supports optional CNAME lookups. (Closed)
Patch Set: Addressing wtc's nits. Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: net/base/host_resolver_proc.cc
diff --git a/net/base/host_resolver_proc.cc b/net/base/host_resolver_proc.cc
index 5ccf01afb4711a7e64919e23997a7fec04d2bb7c..84daae0d3e5afbdd00a567eb8dcb5974a11096f3 100644
--- a/net/base/host_resolver_proc.cc
+++ b/net/base/host_resolver_proc.cc
@@ -67,14 +67,18 @@ HostResolverProc* HostResolverProc::GetDefault() {
return default_proc_;
}
-int HostResolverProc::ResolveUsingPrevious(const std::string& host,
- AddressFamily address_family,
- AddressList* addrlist) {
+int HostResolverProc::ResolveUsingPrevious(
+ const std::string& host,
+ AddressFamily address_family,
+ HostResolverFlags host_resolver_flags,
+ AddressList* addrlist) {
if (previous_proc_)
- return previous_proc_->Resolve(host, address_family, addrlist);
+ return previous_proc_->Resolve(host, address_family,
+ host_resolver_flags, addrlist);
// Final fallback is the system resolver.
- return SystemHostResolverProc(host, address_family, addrlist);
+ return SystemHostResolverProc(host, address_family,
+ host_resolver_flags, addrlist);
}
#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
@@ -152,6 +156,7 @@ ThreadLocalStorage::Slot DnsReloadTimer::tls_index_(base::LINKER_INITIALIZED);
int SystemHostResolverProc(const std::string& host,
AddressFamily address_family,
+ HostResolverFlags host_resolver_flags,
AddressList* addrlist) {
// The result of |getaddrinfo| for empty hosts is inconsistent across systems.
// On Windows it gives the default interface's address, whereas on Linux it
@@ -205,6 +210,9 @@ int SystemHostResolverProc(const std::string& host,
hints.ai_flags = AI_ADDRCONFIG;
#endif
+ if (host_resolver_flags & HOST_RESOLVER_CANONNAME)
+ hints.ai_flags |= AI_CANONNAME;
+
// Restrict result set to only this socket type to avoid duplicates.
hints.ai_socktype = SOCK_STREAM;

Powered by Google App Engine