summaryrefslogtreecommitdiff
path: root/paste/cascade.py
diff options
context:
space:
mode:
authorianb <devnull@localhost>2007-10-11 16:41:20 +0000
committerianb <devnull@localhost>2007-10-11 16:41:20 +0000
commit2845897ec52e4422f28b83e1bab7122209d620ca (patch)
tree8f592c17900d696a79e664002938c9e74c72f886 /paste/cascade.py
parentf3e7610aa20a24f7470e437d20f07a2754fe1eb1 (diff)
downloadpaste-2845897ec52e4422f28b83e1bab7122209d620ca.tar.gz
Content-Length: -1 means we should read indefinitely, not count down to zero (which would of course be fatal)
Diffstat (limited to 'paste/cascade.py')
-rw-r--r--paste/cascade.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/paste/cascade.py b/paste/cascade.py
index 962da31..d939e4a 100644
--- a/paste/cascade.py
+++ b/paste/cascade.py
@@ -80,13 +80,16 @@ class Cascade(object):
if length > 0:
# We have to copy wsgi.input
copy_wsgi_input = True
- if length > 4096 or length == -1:
+ if length > 4096 or length < 0:
f = tempfile.TemporaryFile()
- copy_len = length
- while copy_len:
- chunk = environ['wsgi.input'].read(min(copy_len, 4096))
- f.write(chunk)
- copy_len -= len(chunk)
+ if length < 0:
+ f.write(environ['wsgi.input'].read())
+ else:
+ copy_len = length
+ while copy_len > 0:
+ chunk = environ['wsgi.input'].read(min(copy_len, 4096))
+ f.write(chunk)
+ copy_len -= len(chunk)
f.seek(0)
else:
f = StringIO(environ['wsgi.input'].read(length))