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

Unified Diff: net/base/host_resolver.cc

Issue 45026: Prevent making real DNS lookups by chrome tests. (Closed)
Patch Set: simplified Created 11 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 | « net/base/host_resolver.h ('k') | net/base/host_resolver_unittest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/host_resolver.cc
diff --git a/net/base/host_resolver.cc b/net/base/host_resolver.cc
index d5d97e77ebd803c1f4cbd7714f3cf94f16d756f5..a8580fd6e4e9ed4728dbe74706abdcd95e3662f0 100644
--- a/net/base/host_resolver.cc
+++ b/net/base/host_resolver.cc
@@ -52,13 +52,16 @@ static int HostResolverProc(
static int ResolveAddrInfo(HostMapper* mapper, const std::string& host,
const std::string& port, struct addrinfo** out) {
- int rv;
if (mapper) {
- rv = HostResolverProc(mapper->Map(host), port, out);
+ std::string mapped_host = mapper->Map(host);
+
+ if (mapped_host.empty())
+ return ERR_NAME_NOT_RESOLVED;
+
+ return HostResolverProc(mapped_host, port, out);
} else {
- rv = HostResolverProc(host, port, out);
+ return HostResolverProc(host, port, out);
}
- return rv;
}
//-----------------------------------------------------------------------------
« no previous file with comments | « net/base/host_resolver.h ('k') | net/base/host_resolver_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698