Skip to content

dns: deprecate passing falsy hostname to dns.lookup#23173

Closed
oyyd wants to merge 7 commits into
nodejs:masterfrom
oyyd:remove-dns-falsy-error
Closed

dns: deprecate passing falsy hostname to dns.lookup#23173
oyyd wants to merge 7 commits into
nodejs:masterfrom
oyyd:remove-dns-falsy-error

Conversation

@oyyd

@oyyd oyyd commented Sep 30, 2018

Copy link
Copy Markdown
Contributor

We can dns.lookup a falsy hostname like dns.lookup(false)
for the reason of backwards compatibility long before(see #13119
for detail). This behavior is undocumented and seems useless in
real world apps.

We could also make invalid hostname throw in the future and the
change might be semver-major.

Fixes: #13119

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

We can `dns.lookup` a falsy `hostname` like `dns.lookup(false)`
for the reason of backwards compatibility long before(see nodejs#13119
for detail). This behavior is undocumented and seems useless in
real world apps.

We could also make invalid `hostname` throw in the future and the
change might be semver-major.

Fixes: nodejs#13119
@nodejs-github-bot nodejs-github-bot added the dns Issues and PRs related to the dns subsystem. label Sep 30, 2018
@addaleax addaleax added semver-major PRs that contain breaking changes and should be released in the next major version. deprecations Issues and PRs related to deprecations. labels Sep 30, 2018
@addaleax

Copy link
Copy Markdown
Member

If you look around for other uses of DeprecationWarning in lib/, you’ll see that each of them has a deprecation code – these correspond to the ones listed in doc/api/deprecations.md, and I think this would also need an entry there?

@oyyd

oyyd commented Sep 30, 2018

Copy link
Copy Markdown
Contributor Author

Oh, I thought they are only used in markdowns. Thanks, I'm going to add a deprecation code.

@oyyd oyyd force-pushed the remove-dns-falsy-error branch from 1c636bc to 197af1c Compare September 30, 2018 13:32
@oyyd

oyyd commented Sep 30, 2018

Copy link
Copy Markdown
Contributor Author

Add a new deprecation code and the travis ci is green now.

@vsemozhetbyt vsemozhetbyt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Just some doc nits)

Comment thread doc/api/deprecations.md Outdated
Comment thread doc/api/deprecations.md Outdated
Comment thread doc/api/deprecations.md Outdated
Comment thread lib/internal/dns/utils.js

@lundibundi lundibundi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a few doc nits.

Comment thread doc/api/deprecations.md Outdated
Comment thread doc/api/deprecations.md Outdated
Comment thread doc/api/deprecations.md Outdated
Comment thread doc/api/deprecations.md Outdated
Comment thread doc/api/deprecations.md Outdated
Comment thread doc/api/deprecations.md Outdated
Comment thread doc/api/deprecations.md Outdated
@BridgeAR

BridgeAR commented Oct 2, 2018

Copy link
Copy Markdown
Member

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Oct 2, 2018
@danbev

danbev commented Oct 4, 2018

Copy link
Copy Markdown
Contributor

Re-run of failing node-test-commit-windows-fanned

@addaleax

addaleax commented Oct 4, 2018

Copy link
Copy Markdown
Member

Landed in 26af728 🎉

Thanks for the PR!

@addaleax addaleax closed this Oct 4, 2018
addaleax pushed a commit that referenced this pull request Oct 4, 2018
We can `dns.lookup` a falsy `hostname` like `dns.lookup(false)`
for the reason of backwards compatibility long before(see #13119
for detail). This behavior is undocumented and seems useless in
real world apps.

We could also make invalid `hostname` throw in the future and the
change might be semver-major.

Fixes: #13119

PR-URL: #23173
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
jasnell pushed a commit that referenced this pull request Oct 17, 2018
We can `dns.lookup` a falsy `hostname` like `dns.lookup(false)`
for the reason of backwards compatibility long before(see #13119
for detail). This behavior is undocumented and seems useless in
real world apps.

We could also make invalid `hostname` throw in the future and the
change might be semver-major.

Fixes: #13119

PR-URL: #23173
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. deprecations Issues and PRs related to deprecations. dns Issues and PRs related to the dns subsystem. semver-major PRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dns.lookup allows a "falsy" hostname, but behaviour is undocumented and appears useless

10 participants