diff options
author | ianb <devnull@localhost> | 2009-03-06 00:26:22 +0000 |
---|---|---|
committer | ianb <devnull@localhost> | 2009-03-06 00:26:22 +0000 |
commit | 832e1603db91bf42c83c4a7351ffdc3265ffb1a0 (patch) | |
tree | 15c3333071c9da6c1d764791630811e80c39c5f5 /paste/proxy.py | |
parent | c1cde173851d9713fb0a27f7b6683364ec861940 (diff) | |
download | paste-832e1603db91bf42c83c4a7351ffdc3265ffb1a0.tar.gz |
Have the proxy handle a content-length of -1
Diffstat (limited to 'paste/proxy.py')
-rw-r--r-- | paste/proxy.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/paste/proxy.py b/paste/proxy.py index 7de18c7..cb29c54 100644 --- a/paste/proxy.py +++ b/paste/proxy.py @@ -90,9 +90,14 @@ class Proxy(object): if environ.get('CONTENT_TYPE'): headers['content-type'] = environ['CONTENT_TYPE'] if environ.get('CONTENT_LENGTH'): - headers['content-length'] = environ['CONTENT_LENGTH'] - length = int(environ['CONTENT_LENGTH']) - body = environ['wsgi.input'].read(length) + if environ['CONTENT_LENGTH'] == '-1': + # This is a special case, where the content length is basically undetermined + body = environ['wsgi.input'].read(-1) + headers['content-length'] = str(len(body)) + else: + headers['content-length'] = environ['CONTENT_LENGTH'] + length = int(environ['CONTENT_LENGTH']) + body = environ['wsgi.input'].read(length) else: body = '' |