<?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>127970</bug_id>
          
          <creation_ts>2014-01-30 17:09:56 -0800</creation_ts>
          <short_desc>Solidus stripping in DOMURL::setHostname seems wrong</short_desc>
          <delta_ts>2023-01-25 09:27:17 -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>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>128023</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Maciej Stachowiak">mjs</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>achristensen</cc>
    
    <cc>ap</cc>
    
    <cc>cdumez</cc>
    
    <cc>changseok</cc>
    
    <cc>esprehn+autocc</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>gyuyoung.kim</cc>
    
    <cc>timothygu99</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>974114</commentid>
    <comment_count>0</comment_count>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2014-01-30 17:09:56 -0800</bug_when>
    <thetext>This code in setHostname (also in HTMLAnchorElement) seems dubious and is probably wrong:

void DOMURL::setHostname(const String&amp; value)
{
    // Before setting new value:                                                                                                 
    // Remove all leading U+002F SOLIDUS (&quot;/&quot;) characters.                                                                       
    unsigned i = 0;
    unsigned hostLength = value.length();
    while (value[i] == &apos;/&apos;)
        i++;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1762767</commentid>
    <comment_count>1</comment_count>
    <who name="Timothy Gu">timothygu99</who>
    <bug_when>2021-05-21 22:19:10 -0700</bug_when>
    <thetext>Worth noting that setHost() doesn&apos;t do the solidus stripping. Equivalent Chromium bug is https://crbug.com/1212318</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1763180</commentid>
    <comment_count>2</comment_count>
    <who name="Alex Christensen">achristensen</who>
    <bug_when>2021-05-24 10:25:04 -0700</bug_when>
    <thetext>This code has changed quite a bit since this bug was reported in 2014.  It is now URLDecomposition::setHost which doesn&apos;t have the solidus removal.  If there&apos;s a behavior problem related to this, feel free to reopen or file a new bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1763267</commentid>
    <comment_count>3</comment_count>
    <who name="Timothy Gu">timothygu99</who>
    <bug_when>2021-05-24 15:04:21 -0700</bug_when>
    <thetext>This is still an issue, but it only affects setHostname(), not setHost(). I don&apos;t have permissions to reopen this bug, but consider

    u = new URL(&apos;http://abc/&apos;);
    u.hostname = &apos;////def&apos;;
    console.log(u.href);

versus

    u = new URL(&apos;http://abc/&apos;);
    u.host = &apos;////def&apos;;
    console.log(u.href);

In the first case, the resultant URL is http://def/, while in the second it is http://abc/. The code that does this has indeed moved to URLDecomposition:

https://github.com/WebKit/WebKit/blob/4d78e56eb5b61d8f62844ab855e411477d031870/Source/WebCore/html/URLDecomposition.cpp#L152

Search for &quot;removeAllLeadingSolidusCharacters&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1763339</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2021-05-24 17:03:50 -0700</bug_when>
    <thetext>Reopening per the above comment.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1763566</commentid>
    <comment_count>5</comment_count>
      <attachid>429665</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-05-25 10:33:47 -0700</bug_when>
    <thetext>Created attachment 429665
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1763589</commentid>
    <comment_count>6</comment_count>
      <attachid>429665</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-05-25 11:36:42 -0700</bug_when>
    <thetext>Comment on attachment 429665
Patch

The issue with making this change is that I think we would stop matching other browsers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1763828</commentid>
    <comment_count>7</comment_count>
    <who name="Timothy Gu">timothygu99</who>
    <bug_when>2021-05-25 22:47:00 -0700</bug_when>
    <thetext>Hi Chris, contrary to the commit message, this change would actually _increase_ compatibility with the spec and Firefox. You can tell from the WPT rebaseline that it increases spec compliance, as it passes more tests than before. I am planning to make the change in Chromium as well soon, after some related changes get released first.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1763899</commentid>
    <comment_count>8</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-05-26 07:56:07 -0700</bug_when>
    <thetext>(In reply to Timothy Gu from comment #7)
&gt; Hi Chris, contrary to the commit message, this change would actually
&gt; _increase_ compatibility with the spec and Firefox. You can tell from the
&gt; WPT rebaseline that it increases spec compliance, as it passes more tests
&gt; than before. I am planning to make the change in Chromium as well soon,
&gt; after some related changes get released first.

I am not sure what you mean by increasing compatibility. Matching the spec does not improve compatibility if no browser matches the spec.

As far as I can tell, NO major browser passes this particular WPT test (including the stable version of Firefox I tested). As a result, I believe the spec and WPT test may need to be updated to match browsers instead?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1763936</commentid>
    <comment_count>9</comment_count>
    <who name="Alex Christensen">achristensen</who>
    <bug_when>2021-05-26 09:29:30 -0700</bug_when>
    <thetext>Firefox follows the spec here but fails that test because it doesn&apos;t do anything when setting a hostname that is only solidus characters.  Chrome has the same behavior as WebKit here.  Because of that I don&apos;t think this is the right time for us to make this change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1927711</commentid>
    <comment_count>10</comment_count>
    <who name="Timothy Gu">timothygu99</who>
    <bug_when>2023-01-23 21:13:55 -0800</bug_when>
    <thetext>2023 update: both Chrome and Firefox now follow the spec. Given the following, Chrome and Firefox both print &quot;http://x/&quot;. Safari is the only one that prints &quot;http://abc/&quot;.

    u = new URL(&apos;http://x/&apos;);
    u.hostname = &apos;/abc&apos;;
    console.log(u.href);</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1927865</commentid>
    <comment_count>11</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2023-01-24 10:50:08 -0800</bug_when>
    <thetext>Ok, I&apos;ll take a look.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1927886</commentid>
    <comment_count>12</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2023-01-24 11:57:54 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/9062</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1928160</commentid>
    <comment_count>13</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-01-25 09:26:32 -0800</bug_when>
    <thetext>Committed 259366@main (865cbc8abfc5): &lt;https://commits.webkit.org/259366@main&gt;

Reviewed commits have been landed. Closing PR #9062 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1928162</commentid>
    <comment_count>14</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-01-25 09:27:17 -0800</bug_when>
    <thetext>&lt;rdar://problem/104650674&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>429665</attachid>
            <date>2021-05-25 10:33:47 -0700</date>
            <delta_ts>2021-05-25 11:36:42 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-127970-20210525103346.patch</filename>
            <type>text/plain</type>
            <size>3817</size>
            <attacher name="Chris Dumez">cdumez</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjc4MDEwCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggY2Y3NTJkMzllM2FmN2Qz
YTBkMTZhNTQ4MDE5ZWYwMjI5OTljNDQ1Yi4uNjc4YTkxMjZjMGUwNjI1MmJiNmYzYmEzYmU5ZDMy
NjZkMGZjNjA3ZCAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDE5IEBACisyMDIxLTA1LTI1ICBDaHJp
cyBEdW1leiAgPGNkdW1lekBhcHBsZS5jb20+CisKKyAgICAgICAgU29saWR1cyBzdHJpcHBpbmcg
aW4gRE9NVVJMOjpzZXRIb3N0bmFtZSBzZWVtcyB3cm9uZworICAgICAgICBodHRwczovL2J1Z3Mu
d2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9MTI3OTcwCisKKyAgICAgICAgUmV2aWV3ZWQgYnkg
Tk9CT0RZIChPT1BTISkuCisKKyAgICAgICAgU3RvcCBzdHJpcHBpbmcgc29saWR1cyBpbiBVUkwu
aG9zdG5hbWUgc2V0dGVyLiBUaGlzIGRvZXMgbm90IG1hdGNoIEJsaW5rIG9yIHRoZQorICAgICAg
ICBVUkwgc3BlY2lmaWNhdGlvbi4KKworICAgICAgICBObyBuZXcgdGVzdHMsIHJlYmFzZWxpbmVk
IGV4aXN0aW5nIHRlc3QuCisKKyAgICAgICAgKiBodG1sL1VSTERlY29tcG9zaXRpb24uY3BwOgor
ICAgICAgICAoV2ViQ29yZTo6VVJMRGVjb21wb3NpdGlvbjo6c2V0SG9zdG5hbWUpOgorICAgICAg
ICAoV2ViQ29yZTo6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