diff options
author | Ian Bicking <ian@ianbicking.org> | 2007-10-11 16:41:20 +0000 |
---|---|---|
committer | Ian Bicking <ian@ianbicking.org> | 2007-10-11 16:41:20 +0000 |
commit | 9950e14a003f1a8d7c48fe447cf9d37f147da9c6 (patch) | |
tree | 8f592c17900d696a79e664002938c9e74c72f886 | |
parent | 6012293d8e15469ec2ec91caa1d588f44e73680b (diff) | |
download | paste-git-9950e14a003f1a8d7c48fe447cf9d37f147da9c6.tar.gz |
Content-Length: -1 means we should read indefinitely, not count down to zero (which would of course be fatal)
-rw-r--r-- | paste/cascade.py | 15 |
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)) |