From 0906db75f1941b7162c5442c3b74e6d01a4640e0 Mon Sep 17 00:00:00 2001 From: koichik Date: Thu, 12 May 2011 13:43:24 +0900 Subject: [PATCH 1/2] Fix dns.resolve() with 'PTR' throws Error: Unknown type "PTR" --- lib/dns.js | 2 +- test/simple/test-c-ares.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/dns.js b/lib/dns.js index a71738e893a..3ee997b2fa7 100644 --- a/lib/dns.js +++ b/lib/dns.js @@ -247,7 +247,7 @@ var resolveMap = { A: exports.resolve4, MX: exports.resolveMx, TXT: exports.resolveTxt, SRV: exports.resolveSrv, - PTR: exports.resolvePtr, + PTR: exports.reverse, NS: exports.resolveNs, CNAME: exports.resolveCname }; diff --git a/test/simple/test-c-ares.js b/test/simple/test-c-ares.js index 1f68c53ba26..e7ac67f6c0b 100644 --- a/test/simple/test-c-ares.js +++ b/test/simple/test-c-ares.js @@ -58,3 +58,10 @@ dns.lookup('ipv6.google.com', function(error, result, addressType) { //assert.equal('string', typeof result); assert.equal(6, addressType); }); + +dns.resolve('127.0.0.1', 'PTR', function(error, domains) { + if (error) throw error; + assert.equal(domains.length, 1); + assert.equal(domains[0], 'localhost'); +}); + From a635369fb698ad11e646c244485d480a9cf04836 Mon Sep 17 00:00:00 2001 From: koichik Date: Sun, 15 May 2011 11:59:51 +0900 Subject: [PATCH 2/2] Fix test for dns.resolve('PTR') --- test/simple/test-c-ares.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/simple/test-c-ares.js b/test/simple/test-c-ares.js index e7ac67f6c0b..2bf3a11856a 100644 --- a/test/simple/test-c-ares.js +++ b/test/simple/test-c-ares.js @@ -61,7 +61,6 @@ dns.lookup('ipv6.google.com', function(error, result, addressType) { dns.resolve('127.0.0.1', 'PTR', function(error, domains) { if (error) throw error; - assert.equal(domains.length, 1); - assert.equal(domains[0], 'localhost'); + assert.ok(Array.isArray(domains)); });