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

Unified Diff: net/dns/dns_transaction.cc

Issue 938093003: Always treat .localhost as loopback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add 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
Index: net/dns/dns_transaction.cc
diff --git a/net/dns/dns_transaction.cc b/net/dns/dns_transaction.cc
index beb2197dd55b7bc50d39c71cb70d46c29bfd2a77..31f6683acd12d9fadf7f9e396c5fdfc85c40a2a3 100644
--- a/net/dns/dns_transaction.cc
+++ b/net/dns/dns_transaction.cc
@@ -28,6 +28,7 @@
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
+#include "net/base/net_util.h"
#include "net/dns/dns_protocol.h"
#include "net/dns/dns_query.h"
#include "net/dns/dns_response.h"
@@ -563,6 +564,11 @@ class DnsTransactionImpl : public DnsTransaction,
DCHECK(!hostname_.empty());
DCHECK(!callback_.is_null());
DCHECK(!IsIPLiteral(hostname_));
+
+ // Redirect .localhost queries to localhost to make sure that they are
+ // never sent out on the network, per RFC 6761.
+ if (IsLocalhostTLD(hostname))
+ hostname_ = "localhost";
Ryan Sleevi 2015/02/19 22:24:56 No clue if this is correct; This seems wrong/weird
estark 2015/02/20 01:55:19 Ah, I see what you mean. I changed it to use local
}
~DnsTransactionImpl() override {

Powered by Google App Engine
This is Rietveld 408576698