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: change path parsing for non-special URLs #12058

Closed
wants to merge 3 commits into from

Conversation

watilde
Copy link
Member

@watilde watilde commented Mar 27, 2017

Updates:

Fixes #11962.

Checklist
  • make -j4 test
  • tests are included
  • commit message follows
Affected core subsystem(s)

url, test

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. dont-land-on-v4.x whatwg-url Issues and PRs related to the WHATWG URL implementation. labels Mar 27, 2017
@watilde
Copy link
Member Author

watilde commented Mar 27, 2017

cc @nodejs/url

Copy link
Member

@TimothyGu TimothyGu left a comment

Choose a reason for hiding this comment

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

More in-depth review tomorrow, hopefully.

src/node_url.cc Outdated
@@ -878,7 +880,7 @@ namespace url {
}
url->port = base->port;
state = kPath;
continue;
p--;
Copy link
Member

Choose a reason for hiding this comment

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

Isn't continue equivalent to p--?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's right! Updated to use continue instead of p--. thanks :)

@watilde
Copy link
Member Author

watilde commented Mar 27, 2017

@watilde
Copy link
Member Author

watilde commented Mar 29, 2017

Failed CIs doesn't seem to be related to this PR.

@watilde
Copy link
Member Author

watilde commented Mar 30, 2017

rebased to resolve conflicts.
new ci: https://ci.nodejs.org/job/node-test-pull-request/7105/

src/node_url.cc Outdated
continue;
}
} else if (!has_state_override && ch == '?') {
url->query.clear();
Copy link
Member

Choose a reason for hiding this comment

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

The spec says "set url’s query to the empty string". A URL's query is initially null. You have to make it clear that the query in this case is empty string rather than undefined by setting URL_FLAGS_HAS_QUERY on url->flags.

Copy link
Member

Choose a reason for hiding this comment

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

Good point and good catch.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh good to know it! Thanks. I will update it soon.

src/node_url.cc Outdated
url->query.clear();
state = kQuery;
} else if (!has_state_override && ch == '#') {
url->fragment.clear();
Copy link
Member

Choose a reason for hiding this comment

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

Ditto, but in this case you have to set URL_FLAGS_HAS_FRAGMENT

@watilde watilde force-pushed the feature/file-path branch 2 times, most recently from a3ed1d4 to 8772487 Compare April 2, 2017 06:17
@watilde
Copy link
Member Author

watilde commented Apr 2, 2017

continue;
}
} else if (!has_state_override && ch == '?') {
url->flags |= URL_FLAGS_HAS_QUERY;
Copy link
Member

Choose a reason for hiding this comment

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

Sorry for not being clear. Keep the url->query.clear() there, in addition to setting the flag.

Copy link
Member Author

Choose a reason for hiding this comment

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

oops, I misunderstood it sorry! updated.

This changes to the way path parsing for non-special URLs.
It allows paths to be empty for non-special URLs and also
takes that into account when serializing.

Fixes: nodejs#11962
Refs: whatwg/url#213
Updates:
+ Bring tests url-setter-tests from WPT, and put it as JavaScript
+ Comment out unpassed tests

Refs: web-platform-tests/wpt#5112
Refs: nodejs#11887
@watilde
Copy link
Member Author

watilde commented Apr 2, 2017

@watilde
Copy link
Member Author

watilde commented Apr 3, 2017

Landed in f8f46f9, 50bfef6 and 843b7e6. Thanks.

@watilde watilde closed this Apr 3, 2017
@watilde watilde deleted the feature/file-path branch April 3, 2017 09:18
watilde added a commit that referenced this pull request Apr 3, 2017
This changes to the way path parsing for non-special URLs.
It allows paths to be empty for non-special URLs and also
takes that into account when serializing.

Fixes: #11962
Refs: whatwg/url#213
PR-URL: #12058
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
watilde added a commit that referenced this pull request Apr 3, 2017
Refs: web-platform-tests/wpt#4586
Refs: #11887
PR-URL: #12058
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
watilde added a commit that referenced this pull request Apr 3, 2017
Updates:
+ Bring tests url-setter-tests from WPT, and put it as JavaScript
+ Comment out unpassed tests

Refs: web-platform-tests/wpt#5112
Refs: #11887
PR-URL: #12058
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
@jasnell jasnell mentioned this pull request Apr 4, 2017
italoacasas pushed a commit to italoacasas/node that referenced this pull request Apr 10, 2017
Updates:
+ Bring tests url-setter-tests from WPT, and put it as JavaScript
+ Comment out unpassed tests

Refs: web-platform-tests/wpt#5112
Refs: nodejs#11887
PR-URL: nodejs#12058
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. whatwg-url Issues and PRs related to the WHATWG URL implementation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants