-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
dns: coerce port to number in lookupService #4883
Conversation
LGTM |
/cc @mscdex since this was your suggestion |
LGTM |
2 similar comments
LGTM |
LGTM |
LGTM. Why is this semver-major? |
It changes behavior. Before one could pass 10000000 as the port. Now a TypeError will be thrown. It also accepts a string that can be coerced into a number that is a valid port. Before it did not |
65e92db
to
16d8e62
Compare
Rebased and running CI one more time: https://ci.nodejs.org/job/node-test-pull-request/1470/ |
This probably warrants a doc update and some additional tests. I will add those and then run CI again. Sorry for omitting them in the first place. |
16d8e62
to
8c2cb44
Compare
Ok, docs updated and additional tests added. PTAL |
@@ -126,6 +126,10 @@ on some operating systems (e.g FreeBSD 10.1). | |||
Resolves the given `address` and `port` into a hostname and service using | |||
the operating system's underlying `getnameinfo` implementation. | |||
|
|||
If `address` is not a valid IP address, a TypeError will be thrown. |
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 you add backticks around TypeError
here and below.
Still LGTM with one small comment. |
Previously, port could be any number in dns.lookupService. This change throws a TypeError if port is outside the range of 0-65535. It also coerces the port to a number.
8c2cb44
to
2e87682
Compare
Fixed |
LGTM |
Previously, port could be any number in dns.lookupService. This change throws a TypeError if port is outside the range of 0-65535. It also coerces the port to a number. PR-URL: #4883 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Brian White <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: James M Snell <[email protected]>
Landed in f3be421 |
Previously, port could be any number in dns.lookupService. This change throws a TypeError if port is outside the range of 0-65535. It also coerces the port to a number. PR-URL: nodejs#4883 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Brian White <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: James M Snell <[email protected]>
Previously, port could be any number in dns.lookupService. This change
throws a TypeError if port is outside the range of 0-65535. It also
coerces the port to a number.
This includes the commit from #4882 as it depends on it.
I have separated them into two PRs for the sake of cherry-picking to release branches though as this is semver-major.