Skip to content

Commit

Permalink
Adding FORM_PART_LIMIT for overwriting MultipartParser.part_limit
Browse files Browse the repository at this point in the history
  • Loading branch information
drfho committed Feb 9, 2025
1 parent a2cbf86 commit 98e5d34
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ZPublisher/HTTPRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@

# DOS attack protection -- limiting the amount of memory for forms
# probably should become configurable
FORM_PART_LIMIT = 2 ** 10 # limit for individual form parts
FORM_MEMORY_LIMIT = 2 ** 20 # memory limit for forms
FORM_DISK_LIMIT = 2 ** 30 # disk limit for forms
FORM_MEMFILE_LIMIT = 2 ** 12 # limit for `BytesIO` -> temporary file switch
Expand Down Expand Up @@ -1483,6 +1484,7 @@ def __init__(self, fp, environ):
if content_type == "multipart/form-data":
parts = MultipartParser(
fp, options["boundary"],
part_limit = FORM_PART_LIMIT,
mem_limit=FORM_MEMORY_LIMIT,
disk_limit=FORM_DISK_LIMIT,
memfile_limit=FORM_MEMFILE_LIMIT,
Expand Down

0 comments on commit 98e5d34

Please sign in to comment.