Fix dns.resolve() with 'PTR' throws Error: Unknown type "PTR" #1038

Closed
wants to merge 2 commits into
from

Projects

None yet

3 participants

@koichik

In API docs, dns.resolve() supports 'PTR' record type, but it throws Error: Unknown type "PTR".

Reproduce:

$ node
> require('dns').resolve('127.0.0.1', 'PTR', console.log);
Error: Unknown type "PTR"
    at Object.resolve (dns.js:109:11)
    at [object Context]:1:16
    at Interface.<anonymous> (repl.js:171:22)
    at Interface.emit (events.js:64:17)
    at Interface._onLine (readline.js:153:10)
    at Interface._line (readline.js:408:8)
    at Interface._ttyWrite (readline.js:585:14)
    at ReadStream.<anonymous> (readline.js:73:12)
    at ReadStream.emit (events.js:81:20)
    at ReadStream._emitKey (tty_posix.js:307:10)

This change is the same as:
http://groups.google.com/group/nodejs-dev/browse_thread/thread/9a0917bf097910ec#

@ry
ry commented May 14, 2011

test does not pass on my machine. is there another way of testing this.
% ./node test/simple/test-c-ares.js
[ '127.0.0.1' ]
[ '127.0.0.1' ]

assert.js:81
  throw new assert.AssertionError({
        ^
AssertionError: 1 == 0
    at /Users/ryan/projects/node/test/simple/test-c-ares.js:64:10
    at dns.js:232:11
    at Object.resolve (dns.js:107:5)
    at Object.<anonymous> (/Users/ryan/projects/node/test/simple/test-c-ares.js:62:5)
    at Module._compile (module.js:407:26)
    at Object..js (module.js:413:10)
    at Module.load (module.js:339:31)
    at Function._load (module.js:298:12)
    at Array.0 (module.js:426:10)
    at EventEmitter._tickCallback (node.js:126:26)
@stbuehler

Looks like only one of the in-addr.arpa. NS servers (the first one, a.in-addr-servers.arpa.), returns
1.0.0.127.in-addr.arpa. 86400 IN PTR localhost.
the others return no records (and there is no NS record for 127.in-addr.arpa.).

Of course resolving with libc returns localhost as it is probably listed in /etc/hosts.

@koichik

I changed the test, please try it again.

@ry
ry commented May 16, 2011

that fixed it. thanks

@ry ry closed this in d4f82ea May 16, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment