RESOLVED FIXED 265484
URLParser should parse URLs including authority and a backslash after the host
https://bugs.webkit.org/show_bug.cgi?id=265484
Summary URLParser should parse URLs including authority and a backslash after the host
dave caruso
Reported 2023-11-28 15:30:43 PST
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
Karl Dubost
Comment 1 2023-11-28 17:59:00 PST
Dave, thanks for the report. Is there a missing string in the bug report? > the text ` > `,
dave caruso
Comment 2 2023-11-28 18:12:06 PST
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.
Alex Christensen
Comment 4 2023-11-29 09:31:57 PST
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
Comment 5 2023-11-29 11:05:09 PST
I can work on a PR this weekend. Thanks for pointing me to the tests.
Alex Christensen
Comment 6 2023-11-29 11:14:49 PST
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
Comment 7 2023-12-05 15:31:12 PST
Anne van Kesteren
Comment 8 2024-02-16 15:08:11 PST
EWS
Comment 9 2024-02-17 07:06:28 PST
Committed 274915@main (953476de5074): <https://commits.webkit.org/274915@main> Reviewed commits have been landed. Closing PR #24657 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.