Skip to content

Instantly share code, notes, and snippets.

@bnoordhuis
Created August 25, 2011 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bnoordhuis/5ebbafe376f05ea6bf1d to your computer and use it in GitHub Desktop.
Save bnoordhuis/5ebbafe376f05ea6bf1d to your computer and use it in GitHub Desktop.
diff --git a/lib/dns_uv.js b/lib/dns_uv.js
index cc6a1b5..5208741 100644
--- a/lib/dns_uv.js
+++ b/lib/dns_uv.js
@@ -117,6 +117,13 @@ exports.lookup = function(domain, family, callback) {
return {};
}
+ // Hack to avoid resolver confusion on dual-stack systems.
+ // This is quite likely not the proper solution...
+ if (family === 0 && domain === 'localhost') {
+ callback(null, '127.0.0.1', 4);
+ return {};
+ }
+
var matchedFamily = net.isIP(domain);
if (matchedFamily) {
callback(null, domain, matchedFamily);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment