<?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>18539</bug_id>
          
          <creation_ts>2008-04-16 12:54:53 -0700</creation_ts>
          <short_desc>multipart/form-data not being parsed correctly on server due to &apos;+&apos; in boundary string</short_desc>
          <delta_ts>2009-11-02 11:01:03 -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>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://lists.webkit.org/pipermail/webkit-dev/2008-April/003770.html</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="mark">hoicem</reporter>
          <assigned_to name="Alexey Proskuryakov">ap</assigned_to>
          <cc>ddkilzer</cc>
    
    <cc>jonasmunk</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>77851</commentid>
    <comment_count>0</comment_count>
    <who name="mark">hoicem</who>
    <bug_when>2008-04-16 12:54:53 -0700</bug_when>
    <thetext>Often user entered data submitted via an HTML form is received incorrectly by the web script. Here is an example: 

Please go here: http://demo.jmbsoft.com/cgi-bin/ags/submit.cgi

Enter the following information:

Username, Password: Leave Blank
Name:, Nickname: Whatever
Email: something@validemailaddress.com
Description: Enter a 30-40 character string wwerewr ewr 
Gallery URL: http://www.intotheflood.com/webkit-demo/index.html
Category: Leave as is
Number of Thumbs: 12
Preview Thumb: choose &quot;Let the script select an image from your gallery&quot;

Now hit submit, it will either throw up a success(submission recorded) or invalid message. If you get success, hit back on your browser, webkit should remember all the information you entered, submit again and again and eventually you should land upon an &quot;invalid URL&quot; or &quot;Invalid email&quot; message. 

The same demo URL works fine in all other browsers tested on both Mac and Windows platforms. Also, the same exact form worked fine prior to Safari 3, it&apos;s only since then that this problem has started happening.

After discussing the problem with the experts on the webkit dev list the general opinion seems to be:

&quot;The issue appears to be that when WebKit sent a multipart/form-data boundary
with a &quot;+&quot; character in it, the server-side software wouldn&apos;t decode the
request properly.  (When there was no &quot;+&quot; character in the form boundary,
everything worked fine.)&quot; - David Kilzer

&quot;I&apos;m betting that your upload tool source has a faulty regular expression for grabbing multipart boundaries&quot; - Mark Pauley</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77858</commentid>
    <comment_count>1</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2008-04-16 13:35:22 -0700</bug_when>
    <thetext>Mark, it would be nice to know what software is being used to parse the boundary string, e.g., if it&apos;s custom in-house code or if it&apos;s a third-party framework (e.g. in PHP, Perl, Ruby or some other scripting language).

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77864</commentid>
    <comment_count>2</comment_count>
    <who name="mark">hoicem</who>
    <bug_when>2008-04-16 15:12:35 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; Mark, it would be nice to know what software is being used to parse the
&gt; boundary string, e.g., if it&apos;s custom in-house code or if it&apos;s a third-party
&gt; framework (e.g. in PHP, Perl, Ruby or some other scripting language).
&gt; 

I&apos;m informed by JMBSoft that&apos;s it&apos;s &quot;pure Perl using all custom in-house code&quot;. Would it help if I tried to get the code that handles the form when submitted?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77874</commentid>
    <comment_count>3</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2008-04-16 17:02:07 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; I&apos;m informed by JMBSoft that&apos;s it&apos;s &quot;pure Perl using all custom in-house code&quot;.
&gt; Would it help if I tried to get the code that handles the form when submitted?

Are they using CGI.pm to do the form parsing, or something else?  You should point them at this bug to see if they can reproduce the issue on their own and fix it.

Note that Safari for Windows should behave the same as Safari for Mac OS X.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77876</commentid>
    <comment_count>4</comment_count>
    <who name="mark">hoicem</who>
    <bug_when>2008-04-16 17:22:35 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #2)
&gt; &gt; I&apos;m informed by JMBSoft that&apos;s it&apos;s &quot;pure Perl using all custom in-house code&quot;.
&gt; &gt; Would it help if I tried to get the code that handles the form when submitted?
&gt; 
&gt; Are they using CGI.pm to do the form parsing, or something else?  You should
&gt; point them at this bug to see if they can reproduce the issue on their own and
&gt; fix it.
&gt; 
&gt; Note that Safari for Windows should behave the same as Safari for Mac OS X.
&gt; 

I&apos;ve asked for the source.

Having them try and fix anything isn&apos;t going to happen because this script is an old version and I get the impression. It just happens to be used by lots of sites which my webkit app needs to submit to. Also, I would assume that they&apos;ll be other forms that may use a similar method/script.

All worked fine prior to Safari 3 so what changed in Safari 3? 

I just tested on windows platform Safari 3. At first I thought the bug wasn&apos;t present as I submitted about 50 times and got success every time. However, I eventually did get the error message but this only seemed to happen when I click back and submitted really quickly.


</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126771</commentid>
    <comment_count>5</comment_count>
    <who name="Jonas Munk">jonasmunk</who>
    <bug_when>2009-06-18 14:19:52 -0700</bug_when>
    <thetext>I have the same problem with PHP (Server header: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8j DAV/2 PHP/5.2.9) on Mac OS X i believe it is MacPorts. I have the same problem on work with a Jetty (Java) Server.

So it may not be related to the server.

Seemingly random the upload stalls and the request never completes. The PHP script never gets executed.

This goes well:
multipart/form-data; boundary=----WebKitFormBoundaryVtOqm3BbxLwP0yja
multipart/form-data; boundary=----WebKitFormBoundaryu5as9Aihe0bbIcgv
multipart/form-data; boundary=----WebKitFormBoundaryLlrh0UVE2KYWV5g3
multipart/form-data; boundary=----WebKitFormBoundary1W9R55FRA2GneO7e

This goes wrong:
multipart/form-data; boundary=----WebKitFormBoundaryWISbcqWfZg4l+qej
multipart/form-data; boundary=----WebKitFormBoundaryGAz1V0M1nRZkKq4w
multipart/form-data; boundary=----WebKitFormBoundaryOAQK+G7Ylci9Ca9X
multipart/form-data; boundary=----WebKitFormBoundaryWaUfqbq5fRdQ5LlL

You should really consider looking into this.

Also see:
http://discussions.apple.com/thread.jspa?messageID=9591586
http://code.google.com/p/support/issues/detail?id=2581

(In reply to comment #3)
&gt; (In reply to comment #2)
&gt; &gt; I&apos;m informed by JMBSoft that&apos;s it&apos;s &quot;pure Perl using all custom in-house code&quot;.
&gt; &gt; Would it help if I tried to get the code that handles the form when submitted?
&gt; 
&gt; Are they using CGI.pm to do the form parsing, or something else?  You should
&gt; point them at this bug to see if they can reproduce the issue on their own and
&gt; fix it.
&gt; 
&gt; Note that Safari for Windows should behave the same as Safari for Mac OS X.
&gt; 

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159848</commentid>
    <comment_count>6</comment_count>
      <attachid>42326</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-11-02 10:50:49 -0800</bug_when>
    <thetext>Created attachment 42326
proposed fix

I don&apos;t see a reason not to limit the set of characters further.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159852</commentid>
    <comment_count>7</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-11-02 11:01:03 -0800</bug_when>
    <thetext>Committed &lt;http://trac.webkit.org/changeset/50421&gt;.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>42326</attachid>
            <date>2009-11-02 10:50:49 -0800</date>
            <delta_ts>2009-11-02 10:57:25 -0800</delta_ts>
            <desc>proposed fix</desc>
            <filename>PlusInBoundary.txt</filename>
            <type>text/plain</type>
            <size>3228</size>
            <attacher name="Alexey Proskuryakov">ap</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA1MDQxOSkKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTcgQEAKKzIwMDktMTEtMDIgIEFsZXhleSBQcm9za3VyeWFrb3YgIDxhcEBhcHBs
ZS5jb20+CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAg
aHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTE4NTM5CisgICAgICAgIG11
bHRpcGFydC9mb3JtLWRhdGEgbm90IGJlaW5nIHBhcnNlZCBjb3JyZWN0bHkgb24gc2VydmVyIGR1
ZSB0byAnKycgaW4gYm91bmRhcnkgc3RyaW5nCisKKyAgICAgICAgTm8gdGVzdCAtIHRoZSBjaGFy
YWN0ZXJzIHRoYXQgdGhlIGJvdW5kYXJ5IGlzIG1hZGUgb2YgYXJlIG5vdCBkZXRlcm1pbmlzdGlj
LgorCisgICAgICAgICogcGxhdGZvcm0vbmV0d29yay9Gb3JtRGF0YUJ1aWxkZXIuY3BwOiAoV2Vi
Q29yZTo6Rm9ybURhdGFCdWlsZGVyOjpnZW5lcmF0ZVVuaXF1ZUJvdW5kYXJ5U3RyaW5nKToKKyAg
ICAgICAgRG9uJ3QgZXZlciBwdXQgYSAnKycgaW4gYm91bmRhcnkgc3RyaW5nLCBlaXRoZXIuIFJl
bW92ZWQgYSBGSVhNRSB0byBicmluZyAnLycgYmFjayBvbmNlCisgICAgICAgIEdN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gzNywgMHgzOCwgMHgzOSwgMHg0MSwgMHg0MgogICAgIH07CiAKICAgICAv
LyBTdGFydCB3aXRoIGFuIGluZm9ybWF0aXZlIHByZWZpeC4K
</data>
<flag name="review"
          id="23840"
          type_id="1"
          status="+"
          setter="mitz"
    />
          </attachment>
      

    </bug>

</bugzilla>