Enforce `max_fields` and `max_part_size` in `FormParser`

Merged
KL
6mo ago
+154-3

request.form() accepts max_fields and max_part_size, but these were only forwarded to MultiPartParser. For application/x-www-form-urlencoded bodies, FormParser was constructed without them and had no field-count or field-size checks, so the limits had no effect.

This forwards both limits to FormParser and enforces them while parsing, raising MultiPartException (returned as 400 inside an app) when a body exceeds them. Defaults match MultiPartParser: max_fields=1000, max_part_size=1MB.

AI Disclaimer

This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.