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)