| Index: net/base/host_resolver_proc.cc
|
| ===================================================================
|
| --- net/base/host_resolver_proc.cc (revision 29420)
|
| +++ net/base/host_resolver_proc.cc (working copy)
|
| @@ -52,12 +52,13 @@
|
| }
|
|
|
| int HostResolverProc::ResolveUsingPrevious(const std::string& host,
|
| + AddressFamily address_family,
|
| AddressList* addrlist) {
|
| if (previous_proc_)
|
| - return previous_proc_->Resolve(host, addrlist);
|
| + return previous_proc_->Resolve(host, address_family, addrlist);
|
|
|
| // Final fallback is the system resolver.
|
| - return SystemHostResolverProc(host, addrlist);
|
| + return SystemHostResolverProc(host, address_family, addrlist);
|
| }
|
|
|
| #if defined(OS_LINUX)
|
| @@ -124,7 +125,9 @@
|
|
|
| #endif // defined(OS_LINUX)
|
|
|
| -int SystemHostResolverProc(const std::string& host, AddressList* addrlist) {
|
| +int SystemHostResolverProc(const std::string& host,
|
| + AddressFamily address_family,
|
| + 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
|
| // gives an error. We will make it fail on all platforms for consistency.
|
| @@ -133,8 +136,15 @@
|
|
|
| struct addrinfo* ai = NULL;
|
| struct addrinfo hints = {0};
|
| - hints.ai_family = AF_UNSPEC;
|
|
|
| + switch (address_family) {
|
| + case ADDRESS_FAMILY_IPV4_ONLY:
|
| + hints.ai_family = AF_INET;
|
| + break;
|
| + default:
|
| + hints.ai_family = AF_UNSPEC;
|
| + }
|
| +
|
| #if defined(OS_WIN)
|
| // DO NOT USE AI_ADDRCONFIG ON WINDOWS.
|
| //
|
|
|