Uh oh!
There was an error while loading. Please reload this page.
url: introduce URL_FLAGS_IS_DEFAULT_SCHEME_PORT flag - #20479
Conversation
AyushG3112
commented
May 2, 2018
If anyone could suggest where to add tests, that would be great. The fixture used in the existing test is the one provided by W3C and I'm not sure if I should modify that. |
There was a problem hiding this comment.
The job done by IsDefaultSchemePort is pretty similar to what NormalizePort does already. Can we instead check url->port == -1 as an indicator for default scheme port?
There was a problem hiding this comment.
In the case where URL_FLAGS_IS_DEFAULT_SCHEME_PORT is set, port should already be null. Unless I'm missing something there doesn't seem to be a need to have a conditional here.
There was a problem hiding this comment.
The reason I added the conditional is because the spec explicitly mentions setting the port to null in case of default scheme port.
I can remove it if you think we can just rely on C++ land to send us null in that situation though.
TimothyGu
commented
May 2, 2018
This PR also lacks tests. Please check out https://github.com/nodejs/node/blob/master/test/fixtures/url-setter-tests.js, add a test in there, and then upstream that test to https://github.com/w3c/web-platform-tests/blob/master/url/setters_tests.json. |
AyushG3112
commented
May 3, 2018
@TimothyGu Fixed. PTAL. Also, to upstream the test, do I just open a PR for https://github.com/w3c/web-platform-tests/blob/master/url/setters_tests.json, or is there any other mechanism? |
AyushG3112
commented
May 3, 2018
/cc @nodejs/url PTAL |
Ping |
joyeecheung
commented
May 7, 2018
@AyushG3112 Yes I think so. |
AyushG3112
commented
May 8, 2018
Test has landed at upstream W3C via web-platform-tests/wpt#10892, and I updated the ordering in |
AyushG3112
commented
May 9, 2018
@jasnell could you please run the CI on this? Also, would this be semver major or patch? Because this fixes a bug but changes the output of an action. |
jasnell
commented
May 9, 2018
CI: https://ci.nodejs.org/job/node-test-pull-request/14750/ It's semver-patch :-) |
AyushG3112
commented
May 10, 2018
Do any of the failures look related? |
targos
commented
May 10, 2018
Failures look unrelated. New try: https://ci.nodejs.org/job/node-test-pull-request/14778/ |
AyushG3112
commented
May 10, 2018
Looks like builds timed out this time. Infra issue? |
Could anyone run the CI on this again please? thanks! |
jasnell
commented
May 12, 2018
…d if new port is scheme default, a=testonly Automatic update from web-platform-testsURL: host setter with default port against URL with non-default port See nodejs/node#20479. -- wpt-commits: f0fe4791f5b87491d8d9662832fae543e4edbca1 wpt-pr: 10892
Introduce `URL_FLAGS_IS_DEFAULT_SCHEME_PORT` flag which is retured when the parser detects that the port passed is the default port for that scheme. Fixes: nodejs#20465
AyushG3112
commented
May 15, 2018
Rebased to master in hope of CI passing. Can this have another CI run please? |
| } | ||
| // the port is valid | ||
| url->port = NormalizePort(url->scheme, static_cast<int>(port)); | ||
| if (url->port == -1) { |
There was a problem hiding this comment.
I would prefer no curlies, it's the more common style in our C++ code.
| XX(URL_FLAGS_HAS_QUERY, 0x200) \ | ||
| XX(URL_FLAGS_HAS_FRAGMENT, 0x400) | ||
| XX(URL_FLAGS_HAS_FRAGMENT, 0x400) \ | ||
| XX(URL_FLAGS_IS_DEFAULT_SCHEME_PORT, 0x800) |
There was a problem hiding this comment.
Can we add the final \ if it doesn't break this. It makes diffs cleaner.
apapirovski
commented
May 17, 2018
AyushG3112
commented
May 17, 2018
@apapirovski PTAL |
apapirovski
commented
May 17, 2018
CI: https://ci.nodejs.org/job/node-test-pull-request/14932/ then we land this. |
AyushG3112
commented
May 17, 2018
|
apapirovski
commented
May 17, 2018
@AyushG3112 That one is definitely unrelated. We have a bug in |
AyushG3112
commented
May 18, 2018
@apapirovski what would the next step here be then? Should we wait for the fix to land before landing this, or run the CI on the failed platforms till it is green, or ,assuming |
Introduce `URL_FLAGS_IS_DEFAULT_SCHEME_PORT` flag which is retured when the parser detects that the port passed is the default port for that scheme. PR-URL: nodejs#20479Fixes: nodejs#20465 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
BridgeAR
commented
May 18, 2018
Landed in 11892b0 🎉 |
Introduce `URL_FLAGS_IS_DEFAULT_SCHEME_PORT` flag which is retured when the parser detects that the port passed is the default port for that scheme. PR-URL: #20479Fixes: #20465 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
…d if new port is scheme default, a=testonly Automatic update from web-platform-testsURL: host setter with default port against URL with non-default port See nodejs/node#20479. -- wpt-commits: f0fe4791f5b87491d8d9662832fae543e4edbca1 wpt-pr: 10892 UltraBlame original commit: 497bd5c8c632f4828e13d82f8c7f0f6d7553126c
…d if new port is scheme default, a=testonly Automatic update from web-platform-testsURL: host setter with default port against URL with non-default port See nodejs/node#20479. -- wpt-commits: f0fe4791f5b87491d8d9662832fae543e4edbca1 wpt-pr: 10892 UltraBlame original commit: 497bd5c8c632f4828e13d82f8c7f0f6d7553126c
…d if new port is scheme default, a=testonly Automatic update from web-platform-testsURL: host setter with default port against URL with non-default port See nodejs/node#20479. -- wpt-commits: f0fe4791f5b87491d8d9662832fae543e4edbca1 wpt-pr: 10892 UltraBlame original commit: 497bd5c8c632f4828e13d82f8c7f0f6d7553126c
…d if new port is scheme default, a=testonly Automatic update from web-platform-testsURL: host setter with default port against URL with non-default port See nodejs/node#20479. -- wpt-commits: f0fe4791f5b87491d8d9662832fae543e4edbca1 wpt-pr: 10892
Introduce
URL_FLAGS_IS_DEFAULT_SCHEME_PORTflag which is returedwhen the parser detects that the port passed is the default port
for that scheme.
Fixes: #20465
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes