Bug 265484
Summary: | URLParser should parse URLs including authority and a backslash after the host | ||
---|---|---|---|
Product: | WebKit | Reporter: | dave caruso <me> |
Component: | Web Template Framework | Assignee: | Anne van Kesteren <annevk> |
Status: | RESOLVED FIXED | ||
Severity: | Trivial | CC: | achristensen, annevk, karlcow, mike, webkit-bug-importer |
Priority: | P2 | Keywords: | BrowserCompat, InRadar |
Version: | WebKit Local Build | ||
Hardware: | All | ||
OS: | All |
dave caruso
WTF:URLParser is unable to parse the text `
`, specifically due to the backslash.
In Safari/JSC you can run `new URL` with this string to see an error. Chrome/firefox/node.js all allow parsing this url.
The specification defines one case in host state (https://url.spec.whatwg.org/#host-state) where backslash is allowed when using special urls.
WTF::URLParser::parse does not seem to handle that. I suspect this is a one line fix around line 1486, but I have not tested the patch.
- if (*c == '/' || *c == '?' || *c == '#') {
+ if (*c == '/' || (m_urlIsSpecial && *c == '\\') || *c == '?' || *c == '#') {
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Karl Dubost
Dave, thanks for the report.
Is there a missing string in the bug report?
> the text `
> `,
dave caruso
Yes it seems the url may have been auto-redacted due to it containing authorization.
"http:// a : b @ c \ hello"
i've rewritten the url with spaces. it is any "special" (protocol http/https/file and some others) but there is a backslash instead of a forward slash after the host and starting the path name. the url can also have no path but end in a backslash.
Karl Dubost
https://searchfox.org/wubkat/rev/c20f54808bd9cd41e49a640e8c20923340e4d14b/Source/WTF/wtf/URLParser.cpp#1480-1500
Alex Christensen
I think you're right, Dave. Would you like to make a PR or two, or would you like me to? Either way it should have a test with a special scheme and a test with a non-special scheme. Our tests for this are in LayoutTests/imported/w3c/web-platform-tests/url/resources/urltestdata.json and ideally it would have a PR to the WPT repo as well.
dave caruso
I can work on a PR this weekend. Thanks for pointing me to the tests.
Alex Christensen
Sounds good! Let's just make a WebKit PR for now. WPT will be updated with this in due time.
This command will help in updating the test results:
Tools/Scripts/run-webkit-tests imported/w3c/web-platform-tests/url --reset --no-build
Radar WebKit Bug Importer
<rdar://problem/119219832>
Anne van Kesteren
Pull request: https://github.com/WebKit/WebKit/pull/24657
EWS
Committed 274915@main (953476de5074): <https://commits.webkit.org/274915@main>
Reviewed commits have been landed. Closing PR #24657 and removing active labels.