Ticket #1279 (closed defect: fixed)

Opened 4 years ago

Last modified 3 years ago

Browser: form submit encoding

Reported by: dborca at yahoo dot com Assigned to: bdelbosc
Priority: P2 Milestone: unspecified
Component: funkload Version: unspecified
Severity: normal Keywords: form x-www-form-urlencoded
Cc:

Description

W3C says: The default encoding for all forms is `application/x-www-form-urlencoded' (see http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.2.1). Because funkload sends form through POST, and because webunit sends POST as multipart/form-data, some applications cannot retrieve the parameters passed.

Change History

01/19/06 09:58:53 changed by bdelbosc

  • keywords changed from form as x-www-form-urlencoded to form x-www-form-urlencoded.
  • priority changed from P1 to P2.
  • severity changed from critical to normal.
  • milestone changed from CPS 3.2.5 to unspecified.

Yes this is true W3C says that "multipart/form-data" should be used in combination with the INPUT element, type="file".

Thanks for the report, I will see what I can do,

btw what kind of server application is not able to decode mutlipart/form-data form ?

01/19/06 10:22:24 changed by bdelbosc

  • summary changed from form submit to form submit encoding.

01/19/06 10:50:32 changed by bdelbosc

  • summary changed from form submit encoding to Browser: form submit encoding.

01/26/06 17:38:12 changed by bdelbosc

Daniel Borca wrote:

> HttpServletRequest.getParameterNames() returns an empty Enumeration.
> To parse what FunkLoad sends, it needs a specialized multipart parser.

05/24/06 20:29:38 changed by jehiah@gmail.com

Below is a patch for Funkload 1.5 to submit posts as x-www-form-urlencoded instead of multipart/form-data

--- PatchWebunit.py     2006-01-27 09:37:42.000000000 +0000
+++ PatchWebunit.py     2006-05-24 18:17:30.000000000 +0000
@@ -31,6 +31,7 @@
 import time
 import urlparse
 import httplib
+import urllib
 import cStringIO
 from webunit import cookie
 from webunit.utility import mimeEncode, boundary
@@ -180,18 +181,27 @@
 
     params = None
     if postdata:
-        for field, value in postdata.items():
-            if type(value) == type({}):
-                postdata[field] = []
-                for k, selected in value.items():
-                    if selected: postdata[field].append(k)
-
-        # Do a post with the data file
-        params = mimeEncode(postdata)
-        h.putrequest('POST', url)
-        h.putheader('Content-type', 'multipart/form-data; boundary=%s'%
-            boundary)
+##         for field, value in postdata.items():
+##             if type(value) == type({}):
+##                 postdata[field] = []
+##                 for k, selected in value.items():
+##                     if selected: postdata[field].append(k)
+
+##         # Do a post with the data file
+##         params = mimeEncode(postdata)
+##         h.putrequest('POST', url)
+##         h.putheader('Content-type', 'multipart/form-data; boundary=%s'%
+##             boundary)
+##         h.putheader('Content-length', str(len(params)))
+        newpost = {}
+        for field,value in postdata.items():
+            newpost[field]=value
+            
+        params = urllib.urlencode(newpost)
+        h.putrequest('POST',url)
+        h.putheader('Content-type','application/x-www-form-urlencoded')
         h.putheader('Content-length', str(len(params)))
+        
     else:
         # Normal GET
         h.putrequest('GET', url)

02/23/07 15:34:19 changed by bdelbosc

  • status changed from new to closed.
  • resolution set to fixed.

fixed in changeset [51242].