summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-10-21 23:52:08 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-10-21 23:52:08 +0000
commit375a6d78cb476f865fe5cccbf3277af7afb4d719 (patch)
tree1ac9d9a59763618358c7c9fb88bb0af6b9d38a8c
parent0ffeb3a42fb2a72356a1059d6d773ad521972e5e (diff)
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. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6592 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/core/handlers/wsgi.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/core/handlers/wsgi.py b/django/core/handlers/wsgi.py
index a67c302102..d06eee73f2 100644
--- a/django/core/handlers/wsgi.py
+++ b/django/core/handlers/wsgi.py
@@ -165,7 +165,9 @@ class WSGIRequest(http.HttpRequest):
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