<?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>17042</bug_id>
          
          <creation_ts>2008-01-27 23:06:47 -0800</creation_ts>
          <short_desc>&lt;form&gt; tags used without action attribute but with a &lt;base&gt; tag</short_desc>
          <delta_ts>2008-02-06 14:29:16 -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>Forms</component>
          <version>523.x (Safari 3)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>VERIFIED</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="Robert Sesek">rsesek</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>68423</commentid>
    <comment_count>0</comment_count>
    <who name="Robert Sesek">rsesek</who>
    <bug_when>2008-01-27 23:06:47 -0800</bug_when>
    <thetext>When a HTML document has &lt;base&gt; tag, all relative URIs should be resolved in regards to that (as per the W3 spec on the matter: http://www.w3.org/TR/html401/struct/links.html#h-12.4). However, the handling of &lt;form&gt; elements without an &quot;action&quot; attribute is incorrect (when using Firefox and the HTML spec as references).

If you were to use a &lt;form&gt; tag without an action attribute alongside a &lt;base&gt; tag, then the form will submit to *only* to the href of the &lt;base&gt; tag. Normally, when a &lt;form&gt; tag does not have an action attribute and a &lt;base&gt; tag is not present, the form submits to the originating page.

Thus, the logical behavior should be as follows: when a &lt;form&gt; tag does not have an action attribute and a &lt;base&gt; tag is present, then the form should submit to the href of the &lt;base&gt; tag concatenated by the originating page.

Example:

Base Tag: http://example.com/base/
Originating page: foo.php

Current implementation would submit to: http://example.com/base/
Fixing this bug would result in submitting to: http://example.com/base/foo.php</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68424</commentid>
    <comment_count>1</comment_count>
      <attachid>18734</attachid>
    <who name="Robert Sesek">rsesek</who>
    <bug_when>2008-01-27 23:07:41 -0800</bug_when>
    <thetext>Created attachment 18734
Testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68457</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-01-28 09:56:14 -0800</bug_when>
    <thetext>Both Firefox 2.0.0.9 and IE7 seem to ignore base URI when submitting this form (and submit to &lt;http://bugs.webkit.org/attachment.cgi?submit=Submit+The+Form&gt;). Are you seeing different results?

Does this issue affect any actual sites? This would make it more important, of course.

Confirming as a difference with IE and Firefox, but I&apos;m not sure what behavior would be best.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68469</commentid>
    <comment_count>3</comment_count>
    <who name="Robert Sesek">rsesek</who>
    <bug_when>2008-01-28 11:42:03 -0800</bug_when>
    <thetext>The only site that I&apos;ve experienced this issue on is the internal website we use at my job, so the criticality of it is very low (as far as I can tell).

As for the behavior, logically I think it makes the most sense to submit to (from the attachment):

http://localhost/foo/zoo/base/attachment.cgi?submit=Submit+The+Form

The reasoning: you take the &lt;base&gt; because all relative URIs should be resolved from that. Then concatenate the originating page&apos;s basename (in this case attachment.cgi) because when &lt;form&gt;s do not have an action attribute, it submits to the originating page.

However, this would probably break away from the implementation of IE and FF, so perhaps just submitting to the full URL of the originating page is the best way to do it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68471</commentid>
    <comment_count>4</comment_count>
      <attachid>18741</attachid>
    <who name="Robert Sesek">rsesek</who>
    <bug_when>2008-01-28 12:23:26 -0800</bug_when>
    <thetext>Created attachment 18741
Patch using FF and IE implementation

Here&apos;s a patch that would implement the Firefox and IE behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68832</commentid>
    <comment_count>5</comment_count>
      <attachid>18741</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2008-01-30 12:46:25 -0800</bug_when>
    <thetext>Comment on attachment 18741
Patch using FF and IE implementation

Thanks for contributing this fix!

The code change looks OK to me, but we need a regression test. That&apos;s the policy for the WebKit project -- we require a test for any bug we fix.

The LayoutTests/fast/forms directory has lots of form tests. You can probably start with one of those to make a test. For example, empty-get.html.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68890</commentid>
    <comment_count>6</comment_count>
      <attachid>18808</attachid>
    <who name="Robert Sesek">rsesek</who>
    <bug_when>2008-01-30 21:44:22 -0800</bug_when>
    <thetext>Created attachment 18808
Patch, take 2

Sorry about not submitting the test, I&apos;m not familiar with the procedure. I have updated the patch to include a layout test for this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68939</commentid>
    <comment_count>7</comment_count>
      <attachid>18808</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2008-01-31 10:47:06 -0800</bug_when>
    <thetext>Comment on attachment 18808
Patch, take 2

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69426</commentid>
    <comment_count>8</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2008-02-04 21:34:46 -0800</bug_when>
    <thetext>Landed in r29989.  Thanks for the patch!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>18734</attachid>
            <date>2008-01-27 23:07:41 -0800</date>
            <delta_ts>2008-01-27 23:07:41 -0800</delta_ts>
            <desc>Testcase</desc>
            <filename>testcase.html</filename>
            <type>text/html</type>
            <size>330</size>
            <attacher name="Robert Sesek">rsesek</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgoJPGJhc2UgaHJlZj0iaHR0cDovL2xvY2FsaG9zdC9mb28vem9vL2Jhc2Uv
IiAvPgoJPHRpdGxlPldlYktpdCBUZXN0IENhc2UgZm9yICMxNzA0MjwvdGl0bGU+CgkKPC9oZWFk
PgoKPGJvZHk+CgkKCTxhIGhyZWY9ImxpbmtwYWdlLmh0bWwiPlRoaXMgaXMgYSBsaW5rIHRoYXQg
c2hvdWxkIHVzZSBhIGJhc2UgdGFnLjwvYT4KCQoJPGZvcm0gbWV0aG9kPSJnZXQiPgoJCQoJCTxp
bnB1dCB0eXBlPSJzdWJtaXQiIG5hbWU9InN1Ym1pdCIgdmFsdWU9IlN1Ym1pdCBUaGUgRm9ybSIg
aWQ9InN1Ym1pdCIgLz4KCQkKCTwvZm9ybT4KCgo8L2JvZHk+CjwvaHRtbD4K
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>18741</attachid>
            <date>2008-01-28 12:23:26 -0800</date>
            <delta_ts>2008-01-30 21:44:22 -0800</delta_ts>
            <desc>Patch using FF and IE implementation</desc>
            <filename>patch.diff</filename>
            <type>text/plain</type>
            <size>1170</size>
            <attacher name="Robert Sesek">rsesek</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiAyOTgzNCkKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTMgQEAKKzIwMDgtMDEtMjggIFJvYmVydCBTZXNlayAgPHJzZXNla0BibHVlc3Rh
dGljLm9yZz4KKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KKworICAgICAg
ICBGaXggaHR0cD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AgaWYgKG1fcG9zdCkgewogICAgICAgICBpZiAobV9t
dWx0aXBhcnQgJiYgaXNNYWlsdG9Gb3JtKCkpIHsK
</data>
<flag name="review"
          id="8188"
          type_id="1"
          status="-"
          setter="darin"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>18808</attachid>
            <date>2008-01-30 21:44:22 -0800</date>
            <delta_ts>2008-01-31 10:47:06 -0800</delta_ts>
            <desc>Patch, take 2</desc>
            <filename>patch2.diff</filename>
            <type>text/plain</type>
            <size>3426</size>
            <attacher name="Robert Sesek">rsesek</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiAyOTg4MikKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTUgQEAKKzIwMDgtMDEtMzAgIFJvYmVydCBTZXNlayAgPHJzZXNla0BibHVlc3Rh
dGljLm9yZz4KKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KKworICAgICAg
ICBGaXggaHR0cDovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9MTcwNDIKKyAgICAg
ICAgZm9ybXMgd2l0aG91dCBhY3Rpb24gYXR0cmlidXRlcyBzdWJtaXQgdG8gdGhlIDxiYXNlPiBo
cmVmIGluc3RlYWQgb2YgdGhlIG9yaWdpbmF0aW5nIHBhZ2UKKworICAgICAgICBUZXN0OiBmYXN0
L2Zvcm1zL21pc3NpbmctYWN0aW9uLmh0bWwKKworICAgICAgICAqIGh0bWwvSFRNTEZvcm1FbGVt
ZW50LmNwcDoKKyAgICAgICAgKFdlYkNvcmU6OkhUTUxGb3JtRWxlbW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orCitpZiAoZG9jdW1lbnQuVVJMLmluZGV4T2Yo
Jz8nKSA9PSAtMSkgeworCisgICAgZG9jdW1lbnQuZi5zdWJtaXQoKTsKKworfSBlbHNlIHsKKyAg
ICAKKyAgICBpZiAodW5lc2NhcGUoZG9jdW1lbnQuVVJMLnN1YnN0cmluZyhkb2N1bWVudC5VUkwu
aW5kZXhPZignPycpKzEsIGRvY3VtZW50LlVSTC5sZW5ndGgpKSA9PSAiIikKKyAgICAgICAgZG9j
dW1lbnQud3JpdGUoIjxwPlN1Y2Nlc3M8L3A+Iik7CisgICAgZWxzZQorICAgICAgICBkb2N1bWVu
dC53cml0ZSgiPHA+RmFpbHVyZTwvcD4iKTsKKyAgICAKKyAgICBpZiAod2luZG93LmxheW91dFRl
c3RDb250cm9sbGVyKQorICAgICAgICBsYXlvdXRUZXN0Q29udHJvbGxlci5ub3RpZnlEb25lKCk7
Cit9CisKKzwvc2NyaXB0PgorPC9ib2R5PgorPC9odG1sPgpcIE5vIG5ld2xpbmUgYXQgZW5kIG9m
IGZpbGUK
</data>
<flag name="review"
          id="8207"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>