<?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>21974</bug_id>
          
          <creation_ts>2008-10-30 10:08:09 -0700</creation_ts>
          <short_desc>KURL.setProtocol does not re-interpret the URL properly</short_desc>
          <delta_ts>2023-05-22 03:41:21 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Platform</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>37641</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Brett Wilson (Google)">brettw</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>abarth</cc>
    
    <cc>annevk</cc>
    
    <cc>ap</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>97131</commentid>
    <comment_count>0</comment_count>
    <who name="Brett Wilson (Google)">brettw</who>
    <bug_when>2008-10-30 10:08:09 -0700</bug_when>
    <thetext>KURL.setProtocol technically requires that the URL be completely re-parsed. For example, setting the protocol from http to file would trigger different handling. javascript and data URLs have different backslash handling.

This could mean that creating a URL in this way would produce a different parsing than giving the resulting string to KURL&apos;s constructor. For example,  changing &quot;data:foo/bar&quot; to &quot;http:foo/bar&quot;.

This isn&apos;t a large issue in practice because setProtocol is not often (or maybe ever?) used to change the type of URLs like this, but rather to build up URLs from component parts. However, this function is potentially dangerous or misleading.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>187387</commentid>
    <comment_count>1</comment_count>
    <who name="Brett Wilson (Google)">brettw</who>
    <bug_when>2010-02-03 08:44:40 -0800</bug_when>
    <thetext>Here&apos;s another case:

original URL:
  http://localhost/e:/foo/
then doing:
  url.setProtocol(&quot;file&quot;);
should yield:
  file:///e:/

Instead, it yields:
  file://localhost/e:/foo/
which is wrong. If you feed this to KURL again, you&apos;ll get it correctly canonicalized to:
  file:///e:/foo/

Its scary to have cases where:
  KURL(kurl.string) != kurl;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>187389</commentid>
    <comment_count>2</comment_count>
    <who name="Brett Wilson (Google)">brettw</who>
    <bug_when>2010-02-03 08:46:18 -0800</bug_when>
    <thetext>Note that Firefox and Chrome both get my case in comment 2 correct. IE8 gives some weird error for my testcase that I didn&apos;t bother to figure out.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>187982</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2010-02-04 15:52:07 -0800</bug_when>
    <thetext>&gt; should yield:
&gt;   file:///e:/

Why?

&gt; Instead, it yields:
&gt;   file://localhost/e:/foo/

With ToT WebKit, I&apos;m getting &quot;file:///e:/foo/&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>187999</commentid>
    <comment_count>4</comment_count>
    <who name="Brett Wilson (Google)">brettw</who>
    <bug_when>2010-02-04 16:35:03 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; &gt; should yield:
&gt; &gt;   file:///e:/
&gt; 
&gt; Why?
&gt; 
&gt; &gt; Instead, it yields:
&gt; &gt;   file://localhost/e:/foo/
&gt; 
&gt; With ToT WebKit, I&apos;m getting &quot;file:///e:/foo/&quot;.

Sorry, my example was wrong (should have had &quot;foo&quot;) To clarify setProtocol should trigger the code that removes &quot;localhost&quot; from the file URLs when you set it to file. I used my Windows Safari to test, which is probably out of date.

In fact, looking at the current code, it looks like this entire bug should be fixed. Do you agree?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>188018</commentid>
    <comment_count>5</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2010-02-04 17:07:38 -0800</bug_when>
    <thetext>Not sure - your original examples seem to still fail, if I understand them correctly. But if they fail indeed, and fail for a different reason, it could be better to track them in a new bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1956893</commentid>
    <comment_count>6</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2023-05-22 03:41:21 -0700</bug_when>
    <thetext>We no longer use KURL.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>