-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
url.domainToASCII
inconsistent with WHATWG spec?
#41343
Comments
@armanbilge Node.js try to resovle the single number to a ipv4 address by the code. So input I think this is a feature, not a bug. Since Another tip: Node.js's
|
@MoonBall thanks for looking into this.
That may very well be the case, but the docs currently say:
https://nodejs.org/dist/latest/docs/api/url.html#urldomaintoasciidomain Furthermore, this behavior is inconsistent with the spec and many (all?) other implementations of
I may have misunderstood, but the table-of-contents appears to list For the record, |
I am wrong. The URL module conforms to url spec of whatwg.
I find that Chrome also treat a number to a valid ipv4 address. Maybe it's a conventional implement, even though the ipv4 spec doesn't include it. |
Need a more professional guy to answer if |
Right, but in those screenshots you are invoking the |
So I looked into this a bit more. Actually, it seems these methods were removed from the WHATWG spec in: It's very possible that Node.js is the only "real" implementation of these methods in the wild :) but this means it is difficult/impossible to find another WHATWG implementation of these methods to compare to. Also, there's the philosophical question of whether it makes sense to change the implementation in Node.js to correctly adhere to a spec that's been retired/deprecated (assuming that there even is a bug here, which we have yet to establish anyway). |
As originally defined these methods would go through https://url.spec.whatwg.org/#concept-host-parser first, which does the number-to-IPv4 conversion. So this seems correct. |
@annevk thank you for clarifying this, much appreciated. |
Version
v17.3.0
Platform
Darwin new-host-3.home 20.6.0 Darwin Kernel Version 20.6.0: Tue Oct 12 18:33:42 PDT 2021; root:xnu-7195.141.8~1/RELEASE_X86_64 x86_64
Subsystem
No response
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior?
My expected output is
'42'
.This is based on my understanding of the WHATWG spec: https://url.spec.whatwg.org/#idna
Which in particular says:
What do you see instead?
Additional information
I suspect
url.domainToUnicode
has the same problem.The text was updated successfully, but these errors were encountered: