-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Conversation
cc @nodejs/url |
There was a problem hiding this 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--; |
There was a problem hiding this comment.
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--
?
There was a problem hiding this comment.
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 :)
ceacc41
to
b0e8cae
Compare
Failed CIs doesn't seem to be related to this PR. |
b0e8cae
to
6169f87
Compare
rebased to resolve conflicts. |
src/node_url.cc
Outdated
continue; | ||
} | ||
} else if (!has_state_override && ch == '?') { | ||
url->query.clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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
a3ed1d4
to
8772487
Compare
continue; | ||
} | ||
} else if (!has_state_override && ch == '?') { | ||
url->flags |= URL_FLAGS_HAS_QUERY; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
8772487
to
303d71f
Compare
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
303d71f
to
b103e6e
Compare
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 <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Refs: web-platform-tests/wpt#4586 Refs: #11887 PR-URL: #12058 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
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 <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
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 <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Updates:
Fixes #11962.
Checklist
make -j4 test
Affected core subsystem(s)
url, test