Open Takeda0x64 opened 2 weeks ago
I created a patch to resolve the bug, and now everything works as expected. The issue was in the domainToASCII
function, which returns an empty string when passed an IPv6 address.
if server.punycode isnt false and options.punycode isnt false
idn = url.domainToASCII(addr)
if options.encoding
socket.setEncoding options.encoding
socket.write server.query.replace '$addr', idn
The patch sets both server.punycode
and options.punycode
to false, ensuring that they do not pass the condition check so domainToASCII will not be invoked if IPv4 or IPv6 is passed :
when net.isIP(addr) isnt 0
server = @SERVERS['_']['ip']
server.punycode = false
options.punycode = false
Also IPV6 test passes
✔ should work with google.com
✔ should work with 50.116.8.109
✔ should work with 2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d
✔ should honor specified WHOIS server
✔ should honor specified WHOIS server with port override
Explanation
When performing a WHOIS lookup using the
whois.lookup()
function on an IPv6 address (e.g.,2001:4860:4860::8888
), the response is returningNo match found.
However, when executing the same lookup using the WHOIS command in the CLI, the correct information is displayed, such as thenet range, organization details
, and relevant WHOIS data.Expected Behavior: The node-whois module should return complete and accurate WHOIS information for IPv6 addresses, similar to what is received via the CLI.
Actual Behavior: The module returns incomplete or incorrect results when querying IPv6 addresses
Steps to Reproduce:
1- Call the method wiht Ipv6 input (e.g.,
2001:4860:4860::8888
) :The output is :
Perform the same lookup using the
whois
CLI:CLI response :