Opened 10 years ago

Closed 10 years ago

#2715 closed defect (wontfix)

Uploads from Flash 8 cannot be parsed in Python 2.3

Reported by: frederik@… Owned by: Adrian Holovaty
Component: Core (Other) Version: master
Severity: normal Keywords: upload http
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Flash 8 SWF files can upload files to a server. It features progress monitoring and multiple file upload, making it a useful alternative to regular browser uploads. The HTTP request is improperly formatted however, missing an extra carriage return at the end. This results in the following (partial) stacktrace:

  File "django/core/handlers/", line 99, in _get_post
  File "django/core/handlers/", line 77, in _load_post_and_files
    self._post, self._files = http.parse_file_upload(header_dict, self.raw_post_data)
  File "django/http/", line 58, in parse_file_upload
    msg = email.message_from_string(raw_message)
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/email/", line 52, in message_from_string
    return Parser(_class, strict=strict).parsestr(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/email/", line 75, in parsestr
    return self.parse(StringIO(text), headersonly=headersonly)
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/email/", line 64, in parse
    self._parsebody(root, fp, firstbodyline)
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/email/", line 206, in _parsebody
    raise Errors.BoundaryError(
BoundaryError: No terminating boundary and no trailing empty line

I added patch that adds an extra carriage return after the post_data in parse_file_upload. To my knowledge, the patch doesn't affect normal uploads: Python's email parser parses them just fine. If it does, we could check for the user agent in the header.

Attachments (1)

flash8fix.patch (498 bytes) - added by frederik@… 10 years ago.
Adds an extra carriage return to the raw_message in parse_file_upload

Download all attachments as: .zip

Change History (2)

Changed 10 years ago by frederik@…

Attachment: flash8fix.patch added

Adds an extra carriage return to the raw_message in parse_file_upload

comment:1 Changed 10 years ago by frederik@…

Resolution: wontfix
Status: newclosed

Both python 2.3 and python 2.4 have problems with this message. Python 2.4 can parse it (it adds defects to the message), but the follow-up django code fails.

My advice, however, is to use Flash 9, which generates a correct HTTP request.

Note: See TracTickets for help on using tickets.
Back to Top