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: ensure host setter matches parse for file url #10615

Closed
wants to merge 2 commits into from

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Jan 4, 2017

Technically, file URLs are not permitted to have a port. There is
currently an ambiguity in the URL spec. In the current spec
having a port in a file URL is undefined behavior. In the current
implementation, the port is ignored and handled as if it were part
of the host name. This will be changing once the ambiguity is
resolved in the spec. The spec change may involve either ignoring the
port if specified or throwing with an Invalid URL error if the port
is specified. For now, this test verifies the currently implemented
behavior.

Fixes: #10608

/cc @domenic

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

url

@nodejs-github-bot nodejs-github-bot added dont-land-on-v4.x url Issues and PRs related to the legacy built-in url module. labels Jan 4, 2017
@domenic
Copy link
Contributor

domenic commented Jan 4, 2017

It'd be ideal if these tests were in the urltestdata.json and url_setters.json files (or in some kind of urltestdata-to-upstream.json supplement) so they could be upstreamed and shared among all implementations.

@jasnell
Copy link
Member Author

jasnell commented Jan 4, 2017

Yeah, I'd considered that but wanted to hold off just a bit before doing so until there was more clarity on what the expected spec changes will be. Validating the current underspecified behavior does not seem too worthwhile since there are variances among the implementations on how to handle it

@jasnell
Copy link
Member Author

jasnell commented Jan 4, 2017

That said, there's no reason not to add them to our own copies of those files ;-)

@domenic
Copy link
Contributor

domenic commented Jan 4, 2017

Yeah, in jsdom/whatwg-url we have a to-upstream/urltestdata.json which we run, in addition to the official urltestdata.json (which we download in the pretest script from a known hash). Then we periodically go through and send PRs to web-platform-tests, and when they're accepted, empty out to-upstream/urltestdata.json.

@jasnell
Copy link
Member Author

jasnell commented Jan 4, 2017

Ok, added a commit that adds the additional tests to the files. The file names are different but the patch should apply clean once adjusted for the file path differences.

@joyeecheung joyeecheung added the whatwg-url Issues and PRs related to the WHATWG URL implementation. label Jan 5, 2017
@mscdex mscdex removed the url Issues and PRs related to the legacy built-in url module. label Jan 5, 2017
@jasnell jasnell added the wip Issues and PRs that are still a work in progress. label Jan 6, 2017
@TimothyGu
Copy link
Member

cc @nodejs/url

@joyeecheung
Copy link
Member

Is this ready to be reviewed? Or do we wait until the spec changes land?

@jasnell
Copy link
Member Author

jasnell commented Jan 14, 2017 via email

@watilde
Copy link
Member

watilde commented Apr 11, 2017

@jasnell Could you please rebase this to review?

Technically, file URLs are not permitted to have a port. There is
currently an ambiguity in the URL spec. In the current spec
having a port in a file URL is undefined behavior. In the current
implementation, the port is ignored and handled as if it were part
of the host name. This will be changing once the ambiguity is
resolved in the spec. The spec change may involve either ignoring the
port if specified or throwing with an Invalid URL error if the port
is specified. For now, this test verifies the currently implemented
behavior.

Fixes: nodejs#10608
@jasnell
Copy link
Member Author

jasnell commented Apr 21, 2017

@watilde ... rebased!

@TimothyGu
Copy link
Member

This should be made obsoleted by #12523, which adds similar logic in the C++ layer.

@jasnell
Copy link
Member Author

jasnell commented Apr 22, 2017

@TimothyGu ... happy to close this! Looking forward to #12523 landing!

@jasnell jasnell closed this Apr 22, 2017
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. wip Issues and PRs that are still a work in progress.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

URL: Don't accept port numbers for file urls
7 participants