diff options
author | Ulises Gascón <ulisesgascongonzalez@gmail.com> | 2018-06-22 20:41:42 +0300 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-10-21 07:56:28 +0300 |
commit | beb0f03e78a8fab01169213aafeebf9fabf1db43 (patch) | |
tree | 4e9c35643d66dee33b70dcb101af8c4d0935b93f /lib/internal/dns | |
parent | 6c5e97f2f0928851d613ce90a84a8f8baaba5083 (diff) |
dns: fix inconsistent (hostname vs host)
Fixes: https://github.com/nodejs/node/issues/20892
PR-URL: https://github.com/nodejs/node/pull/23572
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'lib/internal/dns')
-rw-r--r-- | lib/internal/dns/promises.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/internal/dns/promises.js b/lib/internal/dns/promises.js index 8baa0fa0de8..4bf5ac02198 100644 --- a/lib/internal/dns/promises.js +++ b/lib/internal/dns/promises.js @@ -129,34 +129,34 @@ function onlookupservice(err, hostname, service) { this.resolve({ hostname, service }); } -function createLookupServicePromise(host, port) { +function createLookupServicePromise(hostname, port) { return new Promise((resolve, reject) => { const req = new GetNameInfoReqWrap(); - req.host = host; + req.hostname = hostname; req.port = port; req.oncomplete = onlookupservice; req.resolve = resolve; req.reject = reject; - const err = getnameinfo(req, host, port); + const err = getnameinfo(req, hostname, port); if (err) - reject(dnsException(err, 'getnameinfo', host)); + reject(dnsException(err, 'getnameinfo', hostname)); }); } -function lookupService(host, port) { +function lookupService(hostname, port) { if (arguments.length !== 2) - throw new ERR_MISSING_ARGS('host', 'port'); + throw new ERR_MISSING_ARGS('hostname', 'port'); - if (isIP(host) === 0) - throw new ERR_INVALID_OPT_VALUE('host', host); + if (isIP(hostname) === 0) + throw new ERR_INVALID_OPT_VALUE('hostname', hostname); if (!isLegalPort(port)) throw new ERR_SOCKET_BAD_PORT(port); - return createLookupServicePromise(host, +port); + return createLookupServicePromise(hostname, +port); } |