Skip to content

Commit

Permalink
dns_uv: add localhost hack for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Aug 24, 2011
1 parent 2513538 commit 2876141
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/dns_uv.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@ exports.lookup = function(domain, family, callback) {
return {};
}

// Hack required for Windows because Win7 removed the
// localhost entry from c:\WINDOWS\system32\drivers\etc\hosts
// See http://daniel.haxx.se/blog/2011/02/21/localhost-hack-on-windows/
// TODO Remove this once c-ares handles this problem.
if (process.platform == 'win32' && domain == 'localhost') {
callback(null, '127.0.0.1', 4);
return {};
}

var matchedFamily = net.isIP(domain);
if (matchedFamily) {
callback(null, domain, matchedFamily);
Expand Down

0 comments on commit 2876141

Please sign in to comment.