﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
2715	Uploads from Flash 8 cannot be parsed in Python 2.3	frederik@…	Adrian Holovaty	"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.
"	defect	closed	Core (Other)	dev	normal	wontfix	upload http		Unreviewed	0	0	0	0	0	0
