Author: mtredinnick
Date: 2007-10-21 18:52:08 -0500 (Sun, 21 Oct 2007)
New Revision: 6592

Modified:
   django/trunk/django/core/handlers/wsgi.py
Log:
Fixed #3496 -- Handle the case of missing (and hence '0') Content-Length header
in a POST to the wsgi handler. Based on a patch from Mikko Ohtamaa.


Modified: django/trunk/django/core/handlers/wsgi.py
===================================================================
--- django/trunk/django/core/handlers/wsgi.py   2007-10-21 22:06:52 UTC (rev 
6591)
+++ django/trunk/django/core/handlers/wsgi.py   2007-10-21 23:52:08 UTC (rev 
6592)
@@ -165,7 +165,9 @@
                 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


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to