-
-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apply max_form_memory_size another level up in the parser
- Loading branch information
Showing
4 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "Quart" | ||
version = "0.19.6" | ||
version = "0.19.7.dev" | ||
description = "A Python ASGI web microframework with the same API as Flask" | ||
authors = ["pgjones <[email protected]>"] | ||
classifiers = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from __future__ import annotations | ||
|
||
import pytest | ||
from werkzeug.exceptions import RequestEntityTooLarge | ||
|
||
from quart.formparser import MultiPartParser | ||
from quart.wrappers.request import Body | ||
|
||
|
||
async def test_multipart_max_form_memory_size() -> None: | ||
"""max_form_memory_size is tracked across multiple data events.""" | ||
data = b"--bound\r\nContent-Disposition: form-field; name=a\r\n\r\n" | ||
data += b"a" * 15 + b"\r\n--bound--" | ||
body = Body(None, None) | ||
body.set_result(data) | ||
# The buffer size is less than the max size, so multiple data events will be | ||
# returned. The field size is greater than the max. | ||
parser = MultiPartParser(max_form_memory_size=10, buffer_size=5) | ||
|
||
with pytest.raises(RequestEntityTooLarge): | ||
await parser.parse(body, b"bound", 0) |