<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>265484</bug_id>
          
          <creation_ts>2023-11-28 15:30:43 -0800</creation_ts>
          <short_desc>URLParser should parse URLs including authority and a backslash after the host</short_desc>
          <delta_ts>2024-02-17 07:06:30 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Template Framework</component>
          <version>WebKit Local Build</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BrowserCompat, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Trivial</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="chloe caruso">account</reporter>
          <assigned_to name="Anne van Kesteren">annevk</assigned_to>
          <cc>achristensen</cc>
    
    <cc>annevk</cc>
    
    <cc>karlcow</cc>
    
    <cc>mike</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1995432</commentid>
    <comment_count>0</comment_count>
    <who name="chloe caruso">account</who>
    <bug_when>2023-11-28 15:30:43 -0800</bug_when>
    <thetext>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 == &apos;/&apos; || *c == &apos;?&apos; || *c == &apos;#&apos;) {
+ if (*c == &apos;/&apos; || (m_urlIsSpecial &amp;&amp; *c == &apos;\\&apos;) || *c == &apos;?&apos; || *c == &apos;#&apos;) {</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1995488</commentid>
    <comment_count>1</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2023-11-28 17:59:00 -0800</bug_when>
    <thetext>Dave, thanks for the report.
Is there a missing string in the bug report?

&gt; the text `
&gt; `,</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1995490</commentid>
    <comment_count>2</comment_count>
    <who name="chloe caruso">account</who>
    <bug_when>2023-11-28 18:12:06 -0800</bug_when>
    <thetext>Yes it seems the url may have been auto-redacted due to it containing authorization.

&quot;http:// a : b @ c \ hello&quot;

i&apos;ve rewritten the url with spaces. it is any &quot;special&quot; (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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1995505</commentid>
    <comment_count>3</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2023-11-28 18:50:24 -0800</bug_when>
    <thetext>https://searchfox.org/wubkat/rev/c20f54808bd9cd41e49a640e8c20923340e4d14b/Source/WTF/wtf/URLParser.cpp#1480-1500</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1995622</commentid>
    <comment_count>4</comment_count>
    <who name="Alex Christensen">achristensen</who>
    <bug_when>2023-11-29 09:31:57 -0800</bug_when>
    <thetext>I think you&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1995654</commentid>
    <comment_count>5</comment_count>
    <who name="chloe caruso">account</who>
    <bug_when>2023-11-29 11:05:09 -0800</bug_when>
    <thetext>I can work on a PR this weekend. Thanks for pointing me to the tests.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1995659</commentid>
    <comment_count>6</comment_count>
    <who name="Alex Christensen">achristensen</who>
    <bug_when>2023-11-29 11:14:49 -0800</bug_when>
    <thetext>Sounds good!  Let&apos;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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1997249</commentid>
    <comment_count>7</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-12-05 15:31:12 -0800</bug_when>
    <thetext>&lt;rdar://problem/119219832&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2014667</commentid>
    <comment_count>8</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2024-02-16 15:08:11 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/24657</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2014809</commentid>
    <comment_count>9</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-02-17 07:06:28 -0800</bug_when>
    <thetext>Committed 274915@main (953476de5074): &lt;https://commits.webkit.org/274915@main&gt;

Reviewed commits have been landed. Closing PR #24657 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>