﻿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
30227	"POST ""multipart/form-data"" without ""boundary"" causes AttributeError"	Oxygen	nobody	"`curl -sv http://example.com/my_api/ -XPOST -H 'Content-Type: multipart/form-data'`

This causes an ""500 Internal Server Error"", which is supposed to be ""400 Bad Request"".

Traceback with sensitive information removed:

{{{
Traceback (most recent call last):
  ...
  File "".../site-packages/django/core/handlers/wsgi.py"", line 111, in _get_post
    self._load_post_and_files()
  File "".../site-packages/django/http/request.py"", line 310, in _load_post_and_files
    self._post, self._files = self.parse_file_upload(self.META, data)
  File "".../site-packages/django/http/request.py"", line 268, in parse_file_upload
    parser = MultiPartParser(META, post_data, self.upload_handlers, self.encoding)
  File "".../site-packages/django/http/multipartparser.py"", line 72, in __init__
    raise MultiPartParserError('Invalid boundary in multipart: %s' % boundary.decode())
AttributeError: 'NoneType' object has no attribute 'decode'
}}}

Possible fix:

Replace `boundary.decode()` at `django/http/multipartparser.py:72` with `force_text(boundary, errors=""replace"")`
"	Bug	closed	HTTP handling	2.1	Normal	fixed	multipart, boundary		Ready for checkin	1	0	0	0	0	0
