-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ext/node): fix dns.lookup result ordering #26264
Conversation
0814e2e
to
19f4385
Compare
a0d2ced
to
d65fee7
Compare
e51a8d1
to
9257b70
Compare
tests/unit_node/http_test.ts
Outdated
@@ -314,7 +314,7 @@ Deno.test("[node/http] IncomingRequest socket has remoteAddress + remotePort", a | |||
remotePort = req.socket.remotePort; | |||
res.end(); | |||
}); | |||
server.listen(async () => { | |||
server.listen({ host: "0.0.0.0" }, async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove the host and update the request instead to make sure ipv6 is working as expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. In that case we need to update assertion part instead, as server.listen
(without host specified) listens on ipv6 (::1
) on unix and ipv4 (0.0.0.0
) on windows (I think those are the expected behaviors). See 7def448
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This reverts commit d59599f.
partially unblocks #25470
This PR aligns the resolution of
localhost
hostname to Node.js behavior.In Node.js
dns.lookup("localhost", (_, addr) => console.log(addr))
prints ipv6 address::1
, but it prints ipv4 address127.0.0.1
in Deno. That difference causes some errors in the work of enablingcreateConnection
option inhttp.request
(#25470). This PR fixes the issue by aligningdns.lookup
behavior to Node.js.This PR also changes the following behaviors (resolving TODOs):
http.createServer
now listens on ipv6 address[::]
by default on linux/macnet.createServer
now listens on ipv6 address[::]
by default on linux/macThese changes are also alignments to Node.js behaviors.
ref: nodejs/node#39987