Update URL tests to reject hostnames that end in numbers but are not IPv4 IPs#29666
Update URL tests to reject hostnames that end in numbers but are not IPv4 IPs#29666domenic merged 9 commits intoweb-platform-tests:masterfrom
Conversation
Pull from parent
domenic
left a comment
There was a problem hiding this comment.
After implementing the proposed spec update in jsdom/whatwg-url, things mostly pass but there's a couple extra slashes.
Co-authored-by: Domenic Denicola <[email protected]>
Co-authored-by: Domenic Denicola <[email protected]>
annevk
left a comment
There was a problem hiding this comment.
This looks good to me (though @domenic probably wants to run them through whatwg-url again), but having read the change proposal I was thinking we might want to cover these scenarios as well:
- Various domains ending in ".09" and ".09." (always failure as far as I can tell)
- Domains such as "test.0." and generally more dot-at-the-end variants
domenic
left a comment
There was a problem hiding this comment.
Passes in modified whatwg-url so LGTM. I'll be happy to re-run the tests if you add more cases as well.
I've beefed up tests a bit. Let me know what you think. I've run url-constructor.any.html against Chromium hacked up to (hopefully) obey the new rules, and all the new/modified cases pass - I did that before, too, just didn't run the origin tests. This time I've run the origin tests, too, and they also look fine. |
If the last domain label of a URL's domain is numeric, it's parsed as IPv4, and if that fails, it's rejected. E.g., "foo.0", "bar.0.09", "a.1.2.0x.", "1.2.3.4.5" were all previously considered valid non-IPv4 domains, but are now all rejected. Tests: web-platform-tests/wpt#29666. Fixes #560. Co-authored-by: Domenic Denicola <[email protected]> Co-authored-by: Timothy Gu <[email protected]> Co-authored-by: Anne van Kesteren <[email protected]>
This pull request corresponds to the proposed URL spec changes in whatwg/url#619
It also adds a pair of tests for cases that don't seem to be covered by existing tests (A normal IPv4 IP, and a normal IPv4 IP ending in an extra dot)
I moved some pre-existing tests around that were affected by this change, but am also happy to just leave them where they are.