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 == '#') {
Dave, thanks for the report. Is there a missing string in the bug report? > the text ` > `,
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.
https://searchfox.org/wubkat/rev/c20f54808bd9cd41e49a640e8c20923340e4d14b/Source/WTF/wtf/URLParser.cpp#1480-1500
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.
I can work on a PR this weekend. Thanks for pointing me to the tests.
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
<rdar://problem/119219832>
Pull request: https://github.com/WebKit/WebKit/pull/24657
Committed 274915@main (953476de5074): <https://commits.webkit.org/274915@main> Reviewed commits have been landed. Closing PR #24657 and removing active labels.