-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
url: make WHATWG URL implementation more spec compliant #10317
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
cpplint is not happy:
How can I fix this? |
I think it's asking you to do something like this: https://github.com/targos/node/blob/b35a5f84e89e021f27920ffc0c3562e84151d6fe/src/node_url.cc#L120 |
I tried with int32_t and the result is different |
If you're using |
/cc @jasnell |
I won't be able to review until Monday but as long as the fix adheres to the WHATWG spec then +1 and thank you! |
Doesn't this imply that the WhatWG test suite is incomplete? Should the test changes be upstreamed to them? |
@sam-github ... that is entirely possible. |
@sam-github good idea. I opened a PR here: web-platform-tests/wpt#4365 |
goto end; | ||
} | ||
if (pointer - mark == 10) { |
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.
@jasnell Just wondering if you remember what this condition was for? Maybe it was a mistake to remove it.
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.
not off the top of my head... I'll be able to take a look in the next day or two. (sorry, company in town for the holiday is taking up quite a bit of my time this week)
My PR was merged and I updated our copy in the fixtures. Now the tests don't pass because of a spec change: I'll work on it when I have some time |
I had to add 3 other changes so that the updated tests can pass. This is ready to be reviewed again! |
cc @nodejs/collaborators |
Rebased. PTAL. |
Should I squash all the commits together? If I don't, there will be commits with failing tests. |
I'm not familiar with the spec intimately, but I went through the changes and spec and they all LGTM |
Definitely worth squashing so there aren't any commits with failing tests. |
+1 to squashing |
This patch contains the following changes: url: make IPv4 parser more spec compliant * Return int64_t from ParseNumber to prevent overflow for valid big numbers * Don't throw when there are more than 4 parts (it cannot be an IP address) * Correctly interpret the address and don't always throw when there are numbers > 255 Ref: https://url.spec.whatwg.org/#concept-ipv4-parser Fixes: nodejs#10306 url: percent encode fragment to follow spec change Ref: whatwg/url#150 Ref: whatwg/url@373dbed url: fix URL#search setter The check for empty string must be done before removing the leading '?'. Ref: https://url.spec.whatwg.org/#dom-url-search url: set port to null if an empty string is given This is to follow a spec change. Ref: whatwg/url#113 url: fix parsing of paths with Windows drive letter test: update WHATWG URL test fixtures PR-URL: nodejs#10317 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Landed in db18dd8 |
This patch contains the following changes: url: make IPv4 parser more spec compliant * Return int64_t from ParseNumber to prevent overflow for valid big numbers * Don't throw when there are more than 4 parts (it cannot be an IP address) * Correctly interpret the address and don't always throw when there are numbers > 255 Ref: https://url.spec.whatwg.org/#concept-ipv4-parser Fixes: #10306 url: percent encode fragment to follow spec change Ref: whatwg/url#150 Ref: whatwg/url@373dbed url: fix URL#search setter The check for empty string must be done before removing the leading '?'. Ref: https://url.spec.whatwg.org/#dom-url-search url: set port to null if an empty string is given This is to follow a spec change. Ref: whatwg/url#113 url: fix parsing of paths with Windows drive letter test: update WHATWG URL test fixtures PR-URL: #10317 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This patch contains the following changes: url: make IPv4 parser more spec compliant * Return int64_t from ParseNumber to prevent overflow for valid big numbers * Don't throw when there are more than 4 parts (it cannot be an IP address) * Correctly interpret the address and don't always throw when there are numbers > 255 Ref: https://url.spec.whatwg.org/#concept-ipv4-parser Fixes: #10306 url: percent encode fragment to follow spec change Ref: whatwg/url#150 Ref: whatwg/url@373dbed url: fix URL#search setter The check for empty string must be done before removing the leading '?'. Ref: https://url.spec.whatwg.org/#dom-url-search url: set port to null if an empty string is given This is to follow a spec change. Ref: whatwg/url#113 url: fix parsing of paths with Windows drive letter test: update WHATWG URL test fixtures PR-URL: #10317 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Checklist
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
url
Description of change
address)
numbers > 255
Ref: https://url.spec.whatwg.org/#concept-ipv4-parser
Fixes: #10306