From 6ca87c5cf49e5dd82311d23b2c17ebe286c7e9aa Mon Sep 17 00:00:00 2001 From: benoitc Date: Thu, 4 Mar 2010 18:58:27 +0100 Subject: [PATCH] right length --- gunicorn/util.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gunicorn/util.py b/gunicorn/util.py index 54740421..f4f81066 100644 --- a/gunicorn/util.py +++ b/gunicorn/util.py @@ -90,8 +90,11 @@ def close(sock): pass def read_partial(sock, length, buf=None): - if buf is not None and len(buf) >= length: - return buf + if buf is not None: + if len(buf) >= length: + return buf + else: + length = length - len(buf) tmp_buf = sock.recv(length)