From baf4b265b954d8adac37e1b373089d51eb6679d8 Mon Sep 17 00:00:00 2001 From: Adam Hopkins Date: Tue, 6 Jul 2021 00:51:54 +0300 Subject: [PATCH] Manually reset the buffer when streaming request body --- sanic/http.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sanic/http.py b/sanic/http.py index 80301aff5c..a594e60c5e 100644 --- a/sanic/http.py +++ b/sanic/http.py @@ -490,6 +490,9 @@ async def read(self) -> Optional[bytes]: if size <= 0: self.request_body = None + # Because we are leaving one CRLF in the buffer, we manually + # reset the buffer here + self.recv_buffer = bytearray() if size < 0: self.keep_alive = False