From 3a722ed61ab8c3e094bc8d9e7e74133623060ca5 Mon Sep 17 00:00:00 2001 From: John Stark Date: Thu, 18 Apr 2024 10:00:00 +0100 Subject: [PATCH] Fix use of chunk_size parameter (#136) --- multipart/multipart.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/multipart/multipart.py b/multipart/multipart.py index 9c4bafd..9a4d9cd 100644 --- a/multipart/multipart.py +++ b/multipart/multipart.py @@ -1815,7 +1815,7 @@ def parse_form( # Create our form parser. parser = create_form_parser(headers, on_field, on_file) - # Read chunks of 100KiB and write to the parser, but never read more than + # Read chunks of 1MiB and write to the parser, but never read more than # the given Content-Length, if any. content_length = headers.get("Content-Length") if content_length is not None: @@ -1826,7 +1826,7 @@ def parse_form( while True: # Read only up to the Content-Length given. - max_readable = min(content_length - bytes_read, 1048576) + max_readable = min(content_length - bytes_read, chunk_size) buff = input_stream.read(max_readable) # Write to the parser and update our length.