Skip to content

Commit

Permalink
Fix problem that may happen after interrupted chunk-encoding request
Browse files Browse the repository at this point in the history
more in bug report: benoitc#2684

Fixes benoitc#2684
  • Loading branch information
ddzialak authored and radkujawa committed Sep 8, 2023
1 parent a50f4ca commit 197c4a6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gunicorn/http/body.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:])
Expand Down

0 comments on commit 197c4a6

Please sign in to comment.