0
0
mirror of https://github.com/django/django.git synced 2024-11-29 06:03:25 +01:00

Removed HTTP prefixed CONTENT_TYPE/LENGTH headers in MultiPartParser.

The docs say that these headers always appear without the HTTP_ prefix.
This may have been an oversight when they were added in
d725cc9734, the only commit that uses
these names.
This commit is contained in:
Tim Graham 2016-05-06 10:27:43 -04:00
parent bbfad84dd9
commit 086510fde0

View File

@ -68,7 +68,7 @@ class MultiPartParser(object):
# Content-Type should contain multipart and the boundary information.
#
content_type = META.get('HTTP_CONTENT_TYPE', META.get('CONTENT_TYPE', ''))
content_type = META.get('CONTENT_TYPE', '')
if not content_type.startswith('multipart/'):
raise MultiPartParserError('Invalid Content-Type: %s' % content_type)
@ -81,7 +81,7 @@ class MultiPartParser(object):
# Content-Length should contain the length of the body we are about
# to receive.
try:
content_length = int(META.get('HTTP_CONTENT_LENGTH', META.get('CONTENT_LENGTH', 0)))
content_length = int(META.get('CONTENT_LENGTH', 0))
except (ValueError, TypeError):
content_length = 0