Opened 19 years ago
Closed 19 years ago
#2715 closed defect (wontfix)
Uploads from Flash 8 cannot be parsed in Python 2.3
| Reported by: | Owned by: | Adrian Holovaty | |
|---|---|---|---|
| Component: | Core (Other) | Version: | dev |
| Severity: | normal | Keywords: | upload http |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
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/wsgi.py", line 99, in _get_post
self._load_post_and_files()
File "django/core/handlers/wsgi.py", line 77, in _load_post_and_files
self._post, self._files = http.parse_file_upload(header_dict, self.raw_post_data)
File "django/http/__init__.py", 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/__init__.py", 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/Parser.py", line 75, in parsestr
return self.parse(StringIO(text), headersonly=headersonly)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/email/Parser.py", line 64, in parse
self._parsebody(root, fp, firstbodyline)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/email/Parser.py", 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)
Change History (2)
by , 19 years ago
| Attachment: | flash8fix.patch added |
|---|
comment:1 by , 19 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
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.
Adds an extra carriage return to the raw_message in parse_file_upload