From 8e0f24468696b5242ad31471eaf00a676daee97e Mon Sep 17 00:00:00 2001 From: Vladimir Shcherbakov Date: Wed, 30 Sep 2015 10:15:30 -0700 Subject: [PATCH] dns.ADDRCONFIG flag is ignored as a hint if platform is Windows and host name is "localhost" --- lib/net.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/net.js b/lib/net.js index 47422c30dbbea1..5cb560535d7947 100644 --- a/lib/net.js +++ b/lib/net.js @@ -945,7 +945,12 @@ function lookupAndConnect(self, options) { }; if (dnsopts.family !== 4 && dnsopts.family !== 6) { - dnsopts.hints = dns.ADDRCONFIG; + // DO NOT USE AI_ADDRCONFIG ON WINDOWS. + // see http://src.chromium.org/viewvc/chrome/trunk/src/net/dns/host_resolver_proc.cc for details. + if (process.platform !== 'win32' || host != "localhost") { + dnsopts.hints = dns.ADDRCONFIG; + } + // The AI_V4MAPPED hint is not supported on FreeBSD, and getaddrinfo // returns EAI_BADFLAGS. However, it seems to be supported on most other // systems. See