Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
net: support passing null to listen()#14221
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
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.
It may not be obvious, but because of the loop, this tests both cases that were removed below.
refack left a comment
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.
What's the semverity?
lib/net.js Outdated
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.
Tiny nit: could you swap the && clauses (for readability)
refack commented Jul 13, 2017
Regarding |
sam-github commented Jul 14, 2017
I tested this against test/parallel/test-net-listen-port-option.js from #14234 (6.x), and it has a different behaviour. 4.x and 6.x allow I am out of time for the day, but I also suspect that the true/false behaviour may be different. 8.x doesn't support true/false as aliases for 1/0 in |
sam-github left a comment • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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.
I confirmed, this introduces null being allowed not only as an argument to listen(), but also as an option to listen, making it incompatible with 6.x and 4.x:
core/node (pr/14221 $% u=) % ./out/Release/node -pe 'var s = require("http").createServer(function(){}).listen(undefined, function(){}).unref(); s.address()'{address: '::', family: 'IPv6', port: 32983 } core/node (pr/14221 $% u=) % nvm i 6 v6.11.1 is already installed. Now using node v6.11.1 (npm v3.10.10) core/node (pr/14221 $% u=) % node -v && node -pe 'var s = require("http").createServer(function(){}).listen(undefined, function(){}).unref(); s.address()' v6.11.1 internal/net.js:17 throw new RangeError('"port" argument must be >= 0 and < 65536'); BridgeAR commented Aug 30, 2017
Ping @cjihrig |
cjihrig commented Sep 10, 2017
I'm OK with introducing |
cjihrig commented Sep 20, 2017
Any takers on what to do with this one? I'd like to either land it or close it. |
BridgeAR left a comment
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.
I am somewhat against this because I think it is better to have less implicit behavior. It is just less error prone. I do not have such a strong opinion about it to block it though.
lib/net.js Outdated
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.
The comment should reflect the new behavior.
sam-github left a comment
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.
will leave review as a comment
sam-github left a comment
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.
Sorry for the churn, re #14221 (comment)
I agree its consistent to have the argument value to mean the same thing whether it is provided as a positional argument, or the value of an option property.
LGTM
cjihrig commented Sep 22, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@gibfahn is there a problem with the lint job on CI? Linting is failing for me, despite passing locally. See https://ci.nodejs.org/job/node-test-linter/11939/console. It looks like it's happening on other PRs too. See https://ci.nodejs.org/job/node-test-linter/11936/console (although I haven't confirmed if that passes linting locally). EDIT: I confirmed with @mcollina that the second case does have linting errors. I'm still not sure about the linting for this PR though. |
gibfahn commented Sep 22, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@cjihrig probably #15441 getting landed without CI. Let me check. Run on master to confirm: https://ci.nodejs.org/job/node-test-linter/11941/console EDIT: Actually that was green. Also weird that it's now taking me 70s to rerun |
This commit fixes a regression around the handling of null as the port passed to Server#listen(). With this commit, null, undefined, and 0 have the same behavior, which was the case in Node 4. Fixes: nodejs#14205 PR-URL: nodejs#14221 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
cjihrig commented Sep 22, 2017
Here is a CI run: https://ci.nodejs.org/job/node-test-pull-request/10196/ There were no related failures, but the linter failed. It seems like @gibfahn got that straightened out because here is a CI run with no code changes where the linter passes: https://ci.nodejs.org/job/node-test-pull-request/10204/. Thanks @gibfahn Landing this. |
gibfahn commented Sep 22, 2017
|
This commit fixes a regression around the handling of null as the port passed to Server#listen(). With this commit, null, undefined, and 0 have the same behavior, which was the case in Node 4. Fixes: nodejs/node#14205 PR-URL: nodejs/node#14221 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
This commit fixes a regression around the handling of null as the port passed to Server#listen(). With this commit, null, undefined, and 0 have the same behavior, which was the case in Node 4. Fixes: #14205 PR-URL: #14221 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
MylesBorins commented Oct 17, 2017
Early versions of Node.js 8 had a regression around the handling of `null` as the port passed to `Server#listen()`. For details see: nodejs/node#14221
Early versions of Node.js 8 had a regression around the handling of `null` as the port passed to `Server#listen()`. For details see: nodejs/node#14221
Early versions of Node.js 8 had a regression around the handling of `null` as the port passed to `Server#listen()`. For details see: nodejs/node#14221
This commit fixes a regression around the handling of
nullas the port passed toServer#listen(). With this commit,null,undefined, and 0 have the same behavior, which was the case in Node 4.Fixes: #14205
R= @sam-github@evanlucas
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
net