From c2ae9090dc90886e99b03135ea1890d1a73b8dbb Mon Sep 17 00:00:00 2001 From: David Vincelli Date: Thu, 20 Dec 2012 11:48:44 -0500 Subject: [PATCH] handle size 0 read by returning empty buffer It appears the original author meant to return b"" when size == 0 instead of raise ValueError("Size must be positive.") --- gunicorn/http/body.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gunicorn/http/body.py b/gunicorn/http/body.py index 9f685ac0..6e3c0f1a 100644 --- a/gunicorn/http/body.py +++ b/gunicorn/http/body.py @@ -18,7 +18,7 @@ class ChunkedReader(object): def read(self, size): if not isinstance(size, six.integer_types): raise TypeError("size must be an integral type") - if size <= 0: + if size < 0: raise ValueError("Size must be positive.") if size == 0: return b""