summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-17 20:47:02 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-17 20:47:02 +0000
commit4154786bb3f8655d0a9cb6dee37df90ff735c8e7 (patch)
treee3b199fdee56096229b35f0a9102c8f0d08375cb
parent20de5f80ed2d88557a6763a2abd2333ea7552ff9 (diff)
downloadchromium_src-4154786bb3f8655d0a9cb6dee37df90ff735c8e7.zip
chromium_src-4154786bb3f8655d0a9cb6dee37df90ff735c8e7.tar.gz
chromium_src-4154786bb3f8655d0a9cb6dee37df90ff735c8e7.tar.bz2
Undisable HostResolverImplTest.EmptyHost, by making empty host fail to resolve.
Review URL: http://codereview.chromium.org/164546 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23576 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--net/base/host_resolver_impl_unittest.cc7
-rw-r--r--net/base/host_resolver_proc.cc6
2 files changed, 7 insertions, 6 deletions
diff --git a/net/base/host_resolver_impl_unittest.cc b/net/base/host_resolver_impl_unittest.cc
index 3fbf041..11d7424 100644
--- a/net/base/host_resolver_impl_unittest.cc
+++ b/net/base/host_resolver_impl_unittest.cc
@@ -344,12 +344,7 @@ TEST_F(HostResolverImplTest, NumericIPv6Address) {
}
}
-// TODO(eroman): This test is disabled because it is bogus. It used to pass
-// solely because of a bug in the RuleBasedHostMapper -- (empty replacements
-// would map to a failure). However when using the actual host resolver
-// (getaddrinfo), this is not necessarily the case. On windows getaddrinfo("")
-// gives you the address of your machine.
-TEST_F(HostResolverImplTest, DISABLED_EmptyHost) {
+TEST_F(HostResolverImplTest, EmptyHost) {
scoped_refptr<RuleBasedHostResolverProc> resolver_proc =
new RuleBasedHostResolverProc(NULL);
resolver_proc->AllowDirectLookup("*");
diff --git a/net/base/host_resolver_proc.cc b/net/base/host_resolver_proc.cc
index 585a33e..8951646 100644
--- a/net/base/host_resolver_proc.cc
+++ b/net/base/host_resolver_proc.cc
@@ -125,6 +125,12 @@ ThreadLocalStorage::Slot DnsReloadTimer::tls_index_(base::LINKER_INITIALIZED);
#endif // defined(OS_LINUX)
int SystemHostResolverProc(const std::string& host, 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.
+ if (host.empty())
+ return ERR_NAME_NOT_RESOLVED;
+
struct addrinfo* ai = NULL;
struct addrinfo hints = {0};
hints.ai_family = AF_UNSPEC;