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

URL parser inconsistency. #11707

Closed
DylanPiercey opened this issue Mar 6, 2017 · 3 comments
Closed

URL parser inconsistency. #11707

DylanPiercey opened this issue Mar 6, 2017 · 3 comments
Labels
whatwg-url Issues and PRs related to the WHATWG URL implementation.

Comments

@DylanPiercey
Copy link

  • Version: 7.6.0
  • Platform: macOS
  • Subsystem: url

Currently url is having some issues parsing odd hostnames like so:

new URL('http://.test.com').hostname // -> '0.0.0.9'

Where as in safari, chrome, the native url module and everywhere else this would be parsed as '.test.com'.

@mscdex mscdex added the whatwg-url Issues and PRs related to the WHATWG URL implementation. label Mar 6, 2017
@TimothyGu
Copy link
Member

TimothyGu commented Mar 6, 2017

Thanks for reporting! This has been fixed in #11549, which enables stricter parsing of hostnames as specified by the WHATWG URL Standard. The patch should be released in the next v7.x.

@TimothyGu
Copy link
Member

One thing to note is that while most browsers seem to accept the URL, #11549 actually throws an error on such cases:

> new url.URL('http://.test.com').hostname
TypeError: Invalid URL
    at URL.onParseComplete (internal/url.js:87:11)
    at parse (internal/url.js:110:11)
    at new URL (internal/url.js:211:5)
    at repl:1:1

That is, again, in compliance with the URL Standard.

@DylanPiercey
Copy link
Author

@TimothyGu thanks for that I had no idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
whatwg-url Issues and PRs related to the WHATWG URL implementation.
Projects
None yet
Development

No branches or pull requests

3 participants