Fixed #3057 -- Changed WSGI handler not to expect CONTENT_LENGTH. Thanks for the patch, Ivan Sagalaev

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4091 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-11-23 17:06:11 +00:00
parent 23e21df9ca
commit a2e227f2fa
1 changed files with 2 additions and 1 deletions

View File

@ -157,7 +157,8 @@ class WSGIRequest(http.HttpRequest):
return self._raw_post_data return self._raw_post_data
except AttributeError: except AttributeError:
buf = StringIO() buf = StringIO()
content_length = int(self.environ['CONTENT_LENGTH']) # CONTENT_LENGTH might be absent if POST doesn't have content at all (lighttpd)
content_length = int(self.environ.get('CONTENT_LENGTH', ))
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()