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

Unified Diff: net/dns/host_resolver_proc.cc

Issue 938093003: Always treat .localhost as loopback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rsleevi's comments Created 5 years, 10 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
« net/dns/dns_transaction.cc ('K') | « net/dns/dns_transaction.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/host_resolver_proc.cc
diff --git a/net/dns/host_resolver_proc.cc b/net/dns/host_resolver_proc.cc
index f2b10c649bad49e5d083024a45e04594f91324f6..900573ebc6f3a914a9cb628dd4ca6642a69aabf3 100644
--- a/net/dns/host_resolver_proc.cc
+++ b/net/dns/host_resolver_proc.cc
@@ -11,6 +11,7 @@
#include "net/base/address_list.h"
#include "net/base/dns_reloader.h"
#include "net/base/net_errors.h"
+#include "net/base/net_util.h"
#include "net/base/sys_addrinfo.h"
#if defined(OS_OPENBSD)
@@ -189,7 +190,11 @@ int SystemHostResolverCall(const std::string& host,
!defined(OS_ANDROID)
DnsReloaderMaybeReload();
#endif
- int err = getaddrinfo(host.c_str(), NULL, &hints, &ai);
+
+ // Redirect .localhost queries to localhost to make sure that they are
Deprecated (see juliatuttle) 2015/02/24 16:39:23 Nit: ditto.
+ // never sent out on the network, per RFC 6761.
+ int err = getaddrinfo(IsLocalhostTLD(host) ? "localhost." : host.c_str(),
+ NULL, &hints, &ai);
bool should_retry = false;
// If the lookup was restricted (either by address family, or address
// detection), and the results where all localhost of a single family,
« net/dns/dns_transaction.cc ('K') | « net/dns/dns_transaction.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698