Opened 8 months ago

Last modified 3 weeks ago

#35281 assigned Cleanup/optimization

Use HTTP 413 status code for RequestDataTooBig

Reported by: Milan Oberkirch Owned by: Ahmed Ibrahim
Component: HTTP handling Version: 5.0
Severity: Normal Keywords:
Cc: Milan Oberkirch, Ahmed Ibrahim Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Other HTTP servers (e.g. Apache, Nginx) report a body which is to large with the status code 413 "Payload Too Large".

I propose to do the same in Django when handling a RequestDataTooBig exception in https://github.com/django/django/blob/f931cbec21cce3e2e68239c77614e6aa5026b882/django/core/handlers/exception.py#L63

This makes the behavior of a typical stack consisting of a reverse proxy and a Django project predictable for this type of error.

I can work on a patch if this change is acceptable to you.

Change History (13)

comment:1 by Natalia Bidart, 8 months ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

Following https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/413 I think the request makes sense.

I haven't found a previous report about this and the code that added some handling for RequestDataTooBig may have missed to return a more specific code. Tangential follow up of #27820.

comment:2 by Milan Oberkirch, 8 months ago

Owner: changed from nobody to Milan Oberkirch
Status: newassigned

comment:3 by kokobhara, 7 months ago

Hello,

Is this issue still active?
I'm new to both Django and contributing to open-source, and would be more than excited to work on a patch that fixes this.

comment:4 by Milan Oberkirch, 7 months ago

Feel free to take over! Also note this comment: https://github.com/django/django/pull/17960#pullrequestreview-1926197306

comment:5 by Milan Oberkirch, 7 months ago

Owner: Milan Oberkirch removed
Status: assignednew

comment:6 by kokobhara, 7 months ago

Owner: set to kokobhara
Status: newassigned

comment:7 by Robin Swanson, 6 months ago

Hello, I noticed that there hasn't been a modification in 4 weeks. Is it ok if I take over? I am a first time contributor to django and would love the opportunity to take a crack at this.

comment:8 by Simon Charette, 6 months ago

Easy pickings: unset
Owner: kokobhara removed
Status: assignednew

Robin feel free to assign but take a minute to digest why the efforts have stalled in the past weeks first. I don't this this constitutes an easy picking anymore.

Milan, I'll unassign given you closed your MR. Thank you for kicking off the work.

in reply to:  8 ; comment:9 by Ahmed Ibrahim, 3 months ago

Replying to Simon Charette:

Robin feel free to assign but take a minute to digest why the efforts have stalled in the past weeks first. I don't this this constitutes an easy picking anymore.

Milan, I'll unassign given you closed your MR. Thank you for kicking off the work.

Can I handle this one? I have the time needed

in reply to:  9 comment:10 by Natalia Bidart, 3 months ago

Replying to Ahmed Ibrahim:

Replying to Simon Charette:

Robin feel free to assign but take a minute to digest why the efforts have stalled in the past weeks first. I don't this this constitutes an easy picking anymore.

Milan, I'll unassign given you closed your MR. Thank you for kicking off the work.

Can I handle this one? I have the time needed

Hello Ahmed, thank you for your interest in helping Django. Yes, you can assign yourself the ticket and work on it. Please take into consideration all the commentary, specifically the one from the closed PR.

comment:11 by Ahmed Ibrahim, 2 months ago

Owner: set to Ahmed Ibrahim
Status: newassigned

Thanks Natalia, I just took it

comment:12 by Ahmed Ibrahim, 2 months ago

Cc: Ahmed Ibrahim added

comment:13 by Claude Paroz, 3 weeks ago

Note that I provided a WIP PR to explore adding a generic error view which should ease going forward with this ticket. It's a POC for feedback, but not in a reviewable state.

Note: See TracTickets for help on using tickets.
Back to Top