diff --git a/gunicorn/http/body.py b/gunicorn/http/body.py index aa1af2cb3..3c3a8ce74 100644 --- a/gunicorn/http/body.py +++ b/gunicorn/http/body.py @@ -67,7 +67,10 @@ def parse_chunked(self, unreader): # Remove \r\n after chunk rest = rest[size:] while len(rest) < 2: - rest += unreader.read() + new_data = unreader.read() + if not new_data: + break + rest += new_data if rest[:2] != b'\r\n': raise ChunkMissingTerminator(rest[:2]) (size, rest) = self.parse_chunk_size(unreader, data=rest[2:])