Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #3496 -- Handle the case of missing (and hence '0') Content-Len…

…gth header

in a POST to the wsgi handler. Based on a patch from Mikko Ohtamaa.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6592 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 375a6d78cb476f865fe5cccbf3277af7afb4d719 1 parent 0ffeb3a
Malcolm Tredinnick malcolmt authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 django/core/handlers/wsgi.py
4 django/core/handlers/wsgi.py
View
@@ -165,7 +165,9 @@ def _get_raw_post_data(self):
content_length = int(self.environ.get('CONTENT_LENGTH', 0))
except ValueError: # if CONTENT_LENGTH was empty string or not an integer
content_length = 0
- safe_copyfileobj(self.environ['wsgi.input'], buf, size=content_length)
+ if content_length > 0:
+ safe_copyfileobj(self.environ['wsgi.input'], buf,
+ size=content_length)
self._raw_post_data = buf.getvalue()
buf.close()
return self._raw_post_data
Please sign in to comment.
Something went wrong with that request. Please try again.