diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-12-27 02:49:28 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-12-27 02:49:28 +0000 |
| commit | 0cf7bc439129c66df8d64601e885f83b256b4f25 (patch) | |
| tree | a7fd3cd4df5e862578544778d1b720ded59b7274 /django/core/handlers/wsgi.py | |
| parent | c4673e4fb68237f96652d7372bec0283c5446c27 (diff) | |
per-object-permissions: Merged to trunk [4241]
git-svn-id: http://code.djangoproject.com/svn/django/branches/per-object-permissions@4242 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core/handlers/wsgi.py')
| -rw-r--r-- | django/core/handlers/wsgi.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/django/core/handlers/wsgi.py b/django/core/handlers/wsgi.py index 7dc1a4a5eb..71cfecd9a0 100644 --- a/django/core/handlers/wsgi.py +++ b/django/core/handlers/wsgi.py @@ -62,7 +62,7 @@ def safe_copyfileobj(fsrc, fdst, length=16*1024, size=0): data in the body. """ if not size: - return copyfileobj(fsrc, fdst, length) + return while size > 0: buf = fsrc.read(min(length, size)) if not buf: @@ -157,8 +157,11 @@ class WSGIRequest(http.HttpRequest): return self._raw_post_data except AttributeError: buf = StringIO() - # CONTENT_LENGTH might be absent if POST doesn't have content at all (lighttpd) - content_length = int(self.environ.get('CONTENT_LENGTH', 0)) + try: + # 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) self._raw_post_data = buf.getvalue() buf.close() |
