-
Notifications
You must be signed in to change notification settings - Fork 30k
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
ERR_SOCKET_BAD_PORT's static-typed error is not affected by validatePort's allowZero value #32857
Comments
soggychips
changed the title
ERR_SOCKET_BAD_PORT's error is not affected by validatePort's allowZero value
ERR_SOCKET_BAD_PORT's static-typed error is not affected by validatePort's allowZero value
Apr 14, 2020
I'm working on this. |
2 tasks
targos
pushed a commit
that referenced
this issue
May 4, 2020
PR-URL: #32861 Fixes: #32857 Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
targos
pushed a commit
that referenced
this issue
May 7, 2020
PR-URL: #32861 Fixes: #32857 Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
targos
pushed a commit
that referenced
this issue
May 13, 2020
PR-URL: #32861 Fixes: #32857 Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What steps will reproduce the bug?
Socket.send and Socket.connect from dgram.js use a function called validatePort, pulled from internal/validators.js
validatePort takes in an optional options argument, w/ a variable
allowZero
, which defaults to true.ERR_SOCKET_BAD_PORT (internal/errors.js) returns an error w/ string
'%s should be >= 0 and < 65536. Received %s.'
and aRangeError
dgram.js calls validatePort with allowZero set to false, which produces the illogical error:
RangeError [ERR_SOCKET_BAD_PORT]: Port should be >= 0 and < 65536. Received 0.
(The illogical part is that the
>=
does not change to>
when allowZero is set to true.)How often does it reproduce? Is there a required condition?
Always. Call validatePort with port value of 0, with allowZero set to false.
What is the expected behavior?
The error message should have the capability to change the hard-coded
>=
sign to a>
What do you see instead?
RangeError [ERR_SOCKET_BAD_PORT]: Port should be >= 0 and < 65536. Received 0.
Additional information
The text was updated successfully, but these errors were encountered: