classification
Title: cgi.FieldStorage does not parse W3C sample
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.4, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, flox, haypo, orsenthil, python-dev, r.david.murray
Priority: normal Keywords: patch

Created on 2013-05-19 17:45 by flox, last changed 2013-07-07 10:49 by flox. This issue is now closed.

Files
File name Uploaded Description Edit
test_multipart_w3.diff flox, 2013-05-19 17:45 review
patch_multipart_w3.diff flox, 2013-05-19 19:01 review
Messages (5)
msg189609 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2013-05-19 17:45
Trying to parse the W3C sample, it fails in 3.3 (while it passes on 2.7).
http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4 (last example)

   Content-Type: multipart/form-data; boundary=AaB03x

   --AaB03x
   Content-Disposition: form-data; name="submit-name"

   Larry
   --AaB03x
   Content-Disposition: form-data; name="files"
   Content-Type: multipart/mixed; boundary=BbC04y

   --BbC04y
   Content-Disposition: file; filename="file1.txt"
   Content-Type: text/plain

   ... contents of file1.txt ...
   --BbC04y
   Content-Disposition: file; filename="file2.gif"
   Content-Type: image/gif
   Content-Transfer-Encoding: binary

   ...contents of file2.gif...
   --BbC04y--
   --AaB03x--

(broken) test attached.
msg189613 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2013-05-19 18:33
At first glance it seems related to rev d864328a74e4 , issue 4953

The check on self.bytes_read >= self.length returns True because length == -1.
msg189618 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2013-05-19 19:01
This seems to fix it.
msg192535 - (view) Author: Roundup Robot (python-dev) Date: 2013-07-07 10:47
New changeset 406ce103c170 by Florent Xicluna in branch '3.3':
Issue #18013: Fix cgi.FieldStorage to parse the W3C sample form.
http://hg.python.org/cpython/rev/406ce103c170

New changeset 2ab2a2bfea49 by Florent Xicluna in branch 'default':
Merge #18013: Fix cgi.FieldStorage to parse the W3C sample form.
http://hg.python.org/cpython/rev/2ab2a2bfea49
msg192536 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2013-07-07 10:49
Fix committed, with tests.
History
Date User Action Args
2013-07-07 10:49:06floxsetstatus: open -> closed
resolution: fixed
messages: + msg192536

versions: + Python 3.4, - Python 3.2
2013-07-07 10:47:11python-devsetnosy: + python-dev
messages: + msg192535
2013-05-19 19:01:56floxsetfiles: + patch_multipart_w3.diff

messages: + msg189618
stage: needs patch -> patch review
2013-05-19 18:39:40floxsetversions: + Python 3.2
2013-05-19 18:33:29floxsetnosy: + haypo
messages: + msg189613
2013-05-19 18:29:23r.david.murraysetnosy: + r.david.murray
2013-05-19 17:45:49ezio.melottisetnosy: + ezio.melotti

stage: needs patch
2013-05-19 17:45:09floxcreate