Uploads from Flash 8 cannot be parsed in Python 2.3
|Reported by:||Owned by:||Adrian Holovaty|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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.