Fixed #3057 -- Improved wsgi backend to tolerate empty string in CONTENT_LENGTH. Thanks for the patch, Ivan Sagalaev
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4107 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
4a14f2e233
commit
e71fb7c7f2
|
@ -157,8 +157,11 @@ class WSGIRequest(http.HttpRequest):
|
||||||
return self._raw_post_data
|
return self._raw_post_data
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
buf = StringIO()
|
buf = StringIO()
|
||||||
# CONTENT_LENGTH might be absent if POST doesn't have content at all (lighttpd)
|
try:
|
||||||
content_length = int(self.environ.get('CONTENT_LENGTH', 0))
|
# CONTENT_LENGTH might be absent if POST doesn't have content at all (lighttpd)
|
||||||
|
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)
|
safe_copyfileobj(self.environ['wsgi.input'], buf, size=content_length)
|
||||||
self._raw_post_data = buf.getvalue()
|
self._raw_post_data = buf.getvalue()
|
||||||
buf.close()
|
buf.close()
|
||||||
|
|
Loading…
Reference in New Issue