summaryrefslogtreecommitdiff
path: root/lib/dns.js
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2013-10-15 12:51:12 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2013-10-16 21:56:16 +0200
commitceb8740a636e59b1e34cb3db0c3c4c79bb501dfa (patch)
treeadd0d7e01d46444442f77fbdaa5e039029a89f80 /lib/dns.js
parent4234bcce486f5c037c9bcc5d121565b2bec9449c (diff)
downloadnode-new-ceb8740a636e59b1e34cb3db0c3c4c79bb501dfa.tar.gz
dns: rename domain to hostname
A follow-up commit will save the domain name on the request object but we can't call that property 'domain' because that gets intercepted by src/node.cc and lib/domain.js to implement the node.js feature of the same name. To avoid confusion, rename all variables called 'domain' to 'hostname'.
Diffstat (limited to 'lib/dns.js')
-rw-r--r--lib/dns.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/dns.js b/lib/dns.js
index 3e4b90f6e3..9ced633c42 100644
--- a/lib/dns.js
+++ b/lib/dns.js
@@ -94,8 +94,8 @@ function onlookup(err, addresses) {
// Easy DNS A/AAAA look up
-// lookup(domain, [family,] callback)
-exports.lookup = function(domain, family, callback) {
+// lookup(hostname, [family,] callback)
+exports.lookup = function(hostname, family, callback) {
// parse arguments
if (arguments.length === 2) {
callback = family;
@@ -110,7 +110,7 @@ exports.lookup = function(domain, family, callback) {
}
callback = makeAsync(callback);
- if (!domain) {
+ if (!hostname) {
callback(null, null, family === 6 ? 6 : 4);
return {};
}
@@ -119,14 +119,14 @@ exports.lookup = function(domain, family, callback) {
// 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') {
+ if (process.platform == 'win32' && hostname == 'localhost') {
callback(null, '127.0.0.1', 4);
return {};
}
- var matchedFamily = net.isIP(domain);
+ var matchedFamily = net.isIP(hostname);
if (matchedFamily) {
- callback(null, domain, matchedFamily);
+ callback(null, hostname, matchedFamily);
return {};
}
@@ -135,7 +135,7 @@ exports.lookup = function(domain, family, callback) {
family: family,
oncomplete: onlookup
};
- var err = cares.getaddrinfo(req, domain, family);
+ var err = cares.getaddrinfo(req, hostname, family);
if (err) throw errnoException(err, 'getaddrinfo');
callback.immediately = true;
@@ -181,7 +181,7 @@ exports.resolveNaptr = resolveMap.NAPTR = resolver('queryNaptr');
exports.reverse = resolveMap.PTR = resolver('getHostByAddr');
-exports.resolve = function(domain, type_, callback_) {
+exports.resolve = function(hostname, type_, callback_) {
var resolver, callback;
if (util.isString(type_)) {
resolver = resolveMap[type_];
@@ -192,7 +192,7 @@ exports.resolve = function(domain, type_, callback_) {
}
if (util.isFunction(resolver)) {
- return resolver(domain, callback);
+ return resolver(hostname, callback);
} else {
throw new Error('Unknown type "' + type_ + '"');
}