Skip to content

Commit

Permalink
Removed HTTP prefixed CONTENT_TYPE/LENGTH headers in MultiPartParser.
Browse files Browse the repository at this point in the history
The docs say that these headers always appear without the HTTP_ prefix.
This may have been an oversight when they were added in
d725cc9, the only commit that uses
these names.
  • Loading branch information
timgraham committed May 6, 2016
1 parent bbfad84 commit 086510f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions django/http/multipartparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(self, META, input_data, upload_handlers, encoding=None):
# 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)

Expand All @@ -81,7 +81,7 @@ def __init__(self, META, input_data, upload_handlers, encoding=None):
# 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

Expand Down

0 comments on commit 086510f

Please sign in to comment.