From 7d8f68c1a78a17dc4c53b157937957d7320161ee Mon Sep 17 00:00:00 2001 From: "Hazh. M. Adam" Date: Mon, 4 Apr 2022 12:27:55 +0800 Subject: [PATCH] Solving issue #2692 ValueError: count must be a positive integer (got 0) --- gunicorn/http/wsgi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gunicorn/http/wsgi.py b/gunicorn/http/wsgi.py index 478677f4..0fcff5a2 100644 --- a/gunicorn/http/wsgi.py +++ b/gunicorn/http/wsgi.py @@ -371,8 +371,8 @@ class Response(object): if self.is_chunked(): chunk_size = "%X\r\n" % nbytes self.sock.sendall(chunk_size.encode('utf-8')) - - self.sock.sendfile(respiter.filelike, count=nbytes) + if nbytes > 0: + self.sock.sendfile(respiter.filelike, count=nbytes) if self.is_chunked(): self.sock.sendall(b"\r\n")