Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
7 participants
@evanlucas
Copy link
Member

commented Jan 26, 2016

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.

@bnoordhuis

This comment has been minimized.

Copy link
Member

commented Jan 26, 2016

LGTM

@evanlucas

This comment has been minimized.

Copy link
Member Author

commented Jan 26, 2016

/cc @mscdex since this was your suggestion

@mscdex

This comment has been minimized.

Copy link
Contributor

commented Jan 26, 2016

LGTM

2 similar comments
@cjihrig

This comment has been minimized.

Copy link
Contributor

commented Jan 26, 2016

LGTM

@JungMinu

This comment has been minimized.

Copy link
Member

commented Jan 27, 2016

LGTM

@saghul

This comment has been minimized.

Copy link
Member

commented Jan 27, 2016

LGTM. Why is this semver-major?

@evanlucas

This comment has been minimized.

Copy link
Member Author

commented Jan 27, 2016

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

@jasnell

This comment has been minimized.

@evanlucas evanlucas force-pushed the evanlucas:dnsnet-internal2 branch Feb 1, 2016

@evanlucas

This comment has been minimized.

Copy link
Member Author

commented Feb 1, 2016

Rebased and running CI one more time: https://ci.nodejs.org/job/node-test-pull-request/1470/

@evanlucas

This comment has been minimized.

Copy link
Member Author

commented Feb 1, 2016

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.

@evanlucas evanlucas force-pushed the evanlucas:dnsnet-internal2 branch Feb 1, 2016

@evanlucas

This comment has been minimized.

Copy link
Member Author

commented Feb 1, 2016

Ok, docs updated and additional tests added. PTAL

@cjihrig

View changes

doc/api/dns.markdown Outdated
@@ -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.

This comment has been minimized.

Copy link
@cjihrig

cjihrig Feb 1, 2016

Contributor

Can you add backticks around TypeError here and below.

@cjihrig

This comment has been minimized.

Copy link
Contributor

commented Feb 1, 2016

Still LGTM with one small comment.

dns: coerce port to number in lookupService
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.

@evanlucas evanlucas force-pushed the evanlucas:dnsnet-internal2 branch to 2e87682 Feb 1, 2016

@evanlucas

This comment has been minimized.

Copy link
Member Author

commented Feb 1, 2016

Fixed

@jasnell

This comment has been minimized.

Copy link
Member

commented Feb 1, 2016

LGTM

jasnell added a commit that referenced this pull request Feb 1, 2016

dns: coerce port to number in lookupService
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 <info@bnoordhuis.nl>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@jasnell

This comment has been minimized.

Copy link
Member

commented Feb 1, 2016

Landed in f3be421

@jasnell jasnell closed this Feb 1, 2016

@evanlucas evanlucas deleted the evanlucas:dnsnet-internal2 branch Feb 1, 2016

@jasnell jasnell referenced this pull request Mar 17, 2016

Closed

Planning for v6 #5766

scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016

dns: coerce port to number in lookupService
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 <info@bnoordhuis.nl>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.