Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 authored October 21, 2007

Showing 1 changed file with 3 additions and 1 deletion. Show diff stats Hide diff stats

  1. 4  django/core/handlers/wsgi.py
4  django/core/handlers/wsgi.py
@@ -165,7 +165,9 @@ def _get_raw_post_data(self):
165 165
                 content_length = int(self.environ.get('CONTENT_LENGTH', 0))
166 166
             except ValueError: # if CONTENT_LENGTH was empty string or not an integer
167 167
                 content_length = 0
168  
-            safe_copyfileobj(self.environ['wsgi.input'], buf, size=content_length)
  168
+            if content_length > 0:
  169
+                safe_copyfileobj(self.environ['wsgi.input'], buf,
  170
+                        size=content_length)
169 171
             self._raw_post_data = buf.getvalue()
170 172
             buf.close()
171 173
             return self._raw_post_data

0 notes on commit 375a6d7

Please sign in to comment.
Something went wrong with that request. Please try again.