<?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>23609</bug_id>
          
          <creation_ts>2009-01-28 20:16:25 -0800</creation_ts>
          <short_desc>Do not append trailing slash to urls with no path for KURL::parse</short_desc>
          <delta_ts>2009-01-29 06:40:06 -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>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Other</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></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Adam Treat">manyoso</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>darin</cc>
    
    <cc>staikos</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>107451</commentid>
    <comment_count>0</comment_count>
    <who name="Adam Treat">manyoso</who>
    <bug_when>2009-01-28 20:16:25 -0800</bug_when>
    <thetext>The KURL class has recently been changed in revision r40242 to assert in the KURL single argument constructors when the string passed in does not match the result of the parse.  The theory is that KURL::parse method should be idempotent.  However, the KURL::parse method appends a trailing slash to a perfectly valid URL that has no path.  This results in triggering the ASSERT in KURL ctor by passing in a string of &quot;http://google.com&quot; for instance.

Looking at the history it seems KURL has been adding this trailing slash since WebKit was originally created from KHTML.  With this history I am not sure the right thing to do is to remove this appending of the trailing slash, but if the assert is to stay then this is what is required.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107452</commentid>
    <comment_count>1</comment_count>
      <attachid>27136</attachid>
    <who name="Adam Treat">manyoso</who>
    <bug_when>2009-01-28 20:17:30 -0800</bug_when>
    <thetext>Created attachment 27136
Do not append trailing slash in parse

Remove the append of the trailing slash.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107453</commentid>
    <comment_count>2</comment_count>
    <who name="Adam Treat">manyoso</who>
    <bug_when>2009-01-28 20:19:54 -0800</bug_when>
    <thetext>The other option is to remove or edit the assert to take into account the trailing slash I suppose.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107461</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-01-28 22:40:38 -0800</bug_when>
    <thetext>Where is the single argument constructor called from? If it&apos;s called with a string that is not already an output of KURL::parse algorithm, then it is likely that an arbitrary string can be passed via this code path, so a two-argument constructor should be used.

This assertion usually fires on seemingly innocuous things like this one, but uncovers real bugs at call sites nonetheless.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107462</commentid>
    <comment_count>4</comment_count>
      <attachid>27136</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-01-28 22:43:07 -0800</bug_when>
    <thetext>Comment on attachment 27136
Do not append trailing slash in parse

Marking r- for now, because it&apos;s more likely to be a bug at call site.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107516</commentid>
    <comment_count>5</comment_count>
    <who name="Adam Treat">manyoso</who>
    <bug_when>2009-01-29 05:50:48 -0800</bug_when>
    <thetext>It is being called from KURLQt.cpp for the QUrl conversion constructor.  Perhaps I should add a special new constructor to KURL for usage by PLATFORM(QT) that will forgo the parsing entirely since QUrl already accomplishes this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107519</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-01-29 06:23:30 -0800</bug_when>
    <thetext>For posterity: as discussed on IRC, I think that if any constructor were to expect QUrl output to be properly encoded, then KURL::parse should be replaced with an appropriate QUrl method to avoid surprises during re-parsing.

For now, it&apos;s probably best to just use two-argument KURL constructor with a null base.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107520</commentid>
    <comment_count>7</comment_count>
      <attachid>27148</attachid>
    <who name="Adam Treat">manyoso</who>
    <bug_when>2009-01-29 06:24:52 -0800</bug_when>
    <thetext>Created attachment 27148
Makes KURLQt.cpp use two-arg ctor

After discussion with ap it was determined that KURLQt should use the two-arg ctor for implicit conversion of QUrl to KURL.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107521</commentid>
    <comment_count>8</comment_count>
      <attachid>27148</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-01-29 06:26:49 -0800</bug_when>
    <thetext>Comment on attachment 27148
Makes KURLQt.cpp use two-arg ctor

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107522</commentid>
    <comment_count>9</comment_count>
    <who name="Adam Treat">manyoso</who>
    <bug_when>2009-01-29 06:40:06 -0800</bug_when>
    <thetext>Fixed with r40362.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>27136</attachid>
            <date>2009-01-28 20:17:30 -0800</date>
            <delta_ts>2009-01-28 22:43:07 -0800</delta_ts>
            <desc>Do not append trailing slash in parse</desc>
            <filename>noappendslash.patch</filename>
            <type>text/plain</type>
            <size>1472</size>
            <attacher name="Adam Treat">manyoso</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYkNvcmUvQ2hhbmdlTG9nIGIvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXgg
YTJhOTBmOC4uMWE3YjMzZiAxMDA2NDQKLS0tIGEvV2ViQ29yZS9DaGFuZ2VMb2cKKysrIGIvV2Vi
Q29yZS9DaGFuZ2VMb2cKQEAgLTEs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MjUxLDExICsxMjUxLDYgQEAgdm9pZCBLVVJMOjpwYXJzZShj
b25zdCBjaGFyKiB1cmwsIGNvbnN0IFN0cmluZyogb3JpZ2luYWxTdHJpbmcpCiAgICAgfSBlbHNl
CiAgICAgICAgIG1fdXNlclN0YXJ0ID0gbV91c2VyRW5kID0gbV9wYXNzd29yZEVuZCA9IG1faG9z
dEVuZCA9IG1fcG9ydEVuZCA9IHAgLSBidWZmZXIuZGF0YSgpOwogCi0gICAgLy8gRm9yIGNhbm9u
aWNhbGl6YXRpb24sIGVuc3VyZSB3ZSBoYXZlIGEgJy8nIGZvciBubyBwYXRoLgotICAgIC8vIE9u
bHkgZG8gdGhpcyBmb3IgaHR0cCBhbmQgaHR0cHMuCi0gICAgaWYgKGlzSFRUUG9ySFRUUFMgJiYg
cGF0aEVuZCAtIHBhdGhTdGFydCA9PSAwKQotICAgICAgICAqcCsrID0gJy8nOwotCiAgICAgLy8g
YWRkIHBhdGgsIGVzY2FwaW5nIGJhZCBjaGFyYWN0ZXJzCiAgICAgaWYgKCFoaWVyYXJjaGljYWwg
fHwgIWhhc1NsYXNoRG90T3JEb3REb3QodXJsKSkKICAgICAgICAgYXBwZW5kRXNjYXBpbmdCYWRD
aGFycyhwLCB1cmwgKyBwYXRoU3RhcnQsIHBhdGhFbmQgLSBwYXRoU3RhcnQpOwo=
</data>
<flag name="review"
          id="13040"
          type_id="1"
          status="-"
          setter="ap"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>27148</attachid>
            <date>2009-01-29 06:24:52 -0800</date>
            <delta_ts>2009-01-29 06:26:49 -0800</delta_ts>
            <desc>Makes KURLQt.cpp use two-arg ctor</desc>
            <filename>kurlqurl-ctor.patch</filename>
            <type>text/plain</type>
            <size>1373</size>
            <attacher name="Adam Treat">manyoso</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYkNvcmUvQ2hhbmdlTG9nIGIvV2ViQ29yZS9DaGFu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b3JlL3BsYXRm
b3JtL3F0L0tVUkxRdC5jcHAKaW5kZXggY2RjNGY0OC4uMDc2M2ZlMCAxMDA2NDQKLS0tIGEvV2Vi
Q29yZS9wbGF0Zm9ybS9xdC9LVVJMUXQuY3BwCisrKyBiL1dlYkNvcmUvcGxhdGZvcm0vcXQvS1VS
TFF0LmNwcApAQCAtMjAsNiArMjAsNyBAQAogI2luY2x1ZGUgImNvbmZpZy5oIgogI2luY2x1ZGUg
IktVUkwuaCIKICNpbmNsdWRlICJDU3RyaW5nLmgiCisjaW5jbHVkZSAiVGV4dEVuY29kaW5nLmgi
CiAKICNpbmNsdWRlICJOb3RJbXBsZW1lbnRlZC5oIgogI2luY2x1ZGUgInF1cmwuaCIKQEAgLTM2
LDcgKzM3LDcgQEAgc3RhdGljIGlubGluZSBjaGFyIHRvSGV4KGNoYXIgYykKIAogS1VSTDo6S1VS
TChjb25zdCBRVXJsJiB1cmwpCiB7Ci0gICAgKnRoaXMgPSBLVVJMKHVybC50b0VuY29kZWQoKS5j
b25zdERhdGEoKSk7CisgICAgKnRoaXMgPSBLVVJMKEtVUkwoKSwgdXJsLnRvRW5jb2RlZCgpLmNv
bnN0RGF0YSgpLCBVVEY4RW5jb2RpbmcoKSk7CiB9CiAKIEtVUkw6Om9wZXJhdG9yIFFVcmwoKSBj
b25zdAo=
</data>
<flag name="review"
          id="13049"
          type_id="1"
          status="+"
          setter="ap"
    />
          </attachment>
      

    </bug>

</bugzilla>