[Django] #35281: Use HTTP 413 status code for RequestDataTooBig

56 views
Skip to first unread message

Django

unread,
Mar 7, 2024, 8:52:36 AM3/7/24
to django-...@googlegroups.com
#35281: Use HTTP 413 status code for RequestDataTooBig
-----------------------------------------+------------------------
Reporter: zvyn | Owner: nobody
Type: Uncategorized | Status: new
Component: HTTP handling | Version: 5.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-----------------------------------------+------------------------
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/35281>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 8, 2024, 8:11:49 PM3/8/24
to django-...@googlegroups.com
#35281: Use HTTP 413 status code for RequestDataTooBig
--------------------------------------+------------------------------------
Reporter: Milan Oberkirch | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: HTTP handling | Version: 5.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Natalia Bidart):

* stage: Unreviewed => Accepted
* type: Uncategorized => Cleanup/optimization

Comment:

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.
--
Ticket URL: <https://code.djangoproject.com/ticket/35281#comment:1>

Django

unread,
Mar 9, 2024, 7:24:29 AM3/9/24
to django-...@googlegroups.com
#35281: Use HTTP 413 status code for RequestDataTooBig
-------------------------------------+-------------------------------------
Reporter: Milan Oberkirch | Owner: Milan
Type: | Oberkirch
Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: 5.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Milan Oberkirch):

* owner: nobody => Milan Oberkirch
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/35281#comment:2>

Django

unread,
Apr 16, 2024, 12:16:40 PM4/16/24
to django-...@googlegroups.com
#35281: Use HTTP 413 status code for RequestDataTooBig
-------------------------------------+-------------------------------------
Reporter: Milan Oberkirch | Owner: Milan
Type: | Oberkirch
Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: 5.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by kokobhara):

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.
--
Ticket URL: <https://code.djangoproject.com/ticket/35281#comment:3>

Django

unread,
Apr 17, 2024, 6:14:14 AM4/17/24
to django-...@googlegroups.com
#35281: Use HTTP 413 status code for RequestDataTooBig
-------------------------------------+-------------------------------------
Reporter: Milan Oberkirch | Owner: Milan
Type: | Oberkirch
Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: 5.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Milan Oberkirch):

Feel free to take over! Also note this comment:
https://github.com/django/django/pull/17960#pullrequestreview-1926197306
--
Ticket URL: <https://code.djangoproject.com/ticket/35281#comment:4>

Django

unread,
Apr 17, 2024, 6:15:42 AM4/17/24
to django-...@googlegroups.com
#35281: Use HTTP 413 status code for RequestDataTooBig
--------------------------------------+------------------------------------
Reporter: Milan Oberkirch | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: HTTP handling | Version: 5.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Milan Oberkirch):

* owner: Milan Oberkirch => (none)
* status: assigned => new

--
Ticket URL: <https://code.djangoproject.com/ticket/35281#comment:5>

Django

unread,
Apr 17, 2024, 2:00:16 PM4/17/24
to django-...@googlegroups.com
#35281: Use HTTP 413 status code for RequestDataTooBig
-------------------------------------+-------------------------------------
Reporter: Milan Oberkirch | Owner: kokobhara
Type: | Status: assigned
Cleanup/optimization |
Component: HTTP handling | Version: 5.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by kokobhara):

* owner: (none) => kokobhara
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/35281#comment:6>

Django

unread,
May 17, 2024, 7:03:40 PM5/17/24
to django-...@googlegroups.com
#35281: Use HTTP 413 status code for RequestDataTooBig
-------------------------------------+-------------------------------------
Reporter: Milan Oberkirch | Owner: kokobhara
Type: | Status: assigned
Cleanup/optimization |
Component: HTTP handling | Version: 5.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Robin Swanson):

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.
--
Ticket URL: <https://code.djangoproject.com/ticket/35281#comment:7>

Django

unread,
May 17, 2024, 8:38:23 PM5/17/24
to django-...@googlegroups.com
#35281: Use HTTP 413 status code for RequestDataTooBig
--------------------------------------+------------------------------------
Reporter: Milan Oberkirch | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: HTTP handling | Version: 5.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Simon Charette):

* easy: 1 => 0
* owner: kokobhara => (none)
* status: assigned => new

Comment:

Robin feel free to assign but take a minute to digest
[https://github.com/django/django/pull/17960#discussion_r1518576372 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.
--
Ticket URL: <https://code.djangoproject.com/ticket/35281#comment:8>

Django

unread,
Aug 3, 2024, 4:07:32 PM8/3/24
to django-...@googlegroups.com
#35281: Use HTTP 413 status code for RequestDataTooBig
--------------------------------------+------------------------------------
Reporter: Milan Oberkirch | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: HTTP handling | Version: 5.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by Ahmed Ibrahim):

Replying to [comment:8 Simon Charette]:
> Robin feel free to assign but take a minute to digest
[https://github.com/django/django/pull/17960#discussion_r1518576372 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
--
Ticket URL: <https://code.djangoproject.com/ticket/35281#comment:9>

Django

unread,
Aug 5, 2024, 12:36:37 PM8/5/24
to django-...@googlegroups.com
#35281: Use HTTP 413 status code for RequestDataTooBig
--------------------------------------+------------------------------------
Reporter: Milan Oberkirch | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: HTTP handling | Version: 5.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by Natalia Bidart):

Replying to [comment:9 Ahmed Ibrahim]:
> Replying to [comment:8 Simon Charette]:
> > Robin feel free to assign but take a minute to digest
[https://github.com/django/django/pull/17960#discussion_r1518576372 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.
--
Ticket URL: <https://code.djangoproject.com/ticket/35281#comment:10>

Django

unread,
Sep 4, 2024, 3:52:24 AM9/4/24
to django-...@googlegroups.com
#35281: Use HTTP 413 status code for RequestDataTooBig
-------------------------------------+-------------------------------------
Reporter: Milan Oberkirch | Owner: Ahmed
Type: | Ibrahim
Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: 5.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ahmed Ibrahim):

* owner: (none) => Ahmed Ibrahim
* status: new => assigned

Comment:

Thanks Natalia, I just took it
--
Ticket URL: <https://code.djangoproject.com/ticket/35281#comment:11>

Django

unread,
Sep 4, 2024, 3:58:00 AM9/4/24
to django-...@googlegroups.com
#35281: Use HTTP 413 status code for RequestDataTooBig
-------------------------------------+-------------------------------------
Reporter: Milan Oberkirch | Owner: Ahmed
Type: | Ibrahim
Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: 5.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ahmed Ibrahim):

* cc: Ahmed Ibrahim (added)

--
Ticket URL: <https://code.djangoproject.com/ticket/35281#comment:12>

Django

unread,
Oct 26, 2024, 2:54:00 PM10/26/24
to django-...@googlegroups.com
#35281: Use HTTP 413 status code for RequestDataTooBig
-------------------------------------+-------------------------------------
Reporter: Milan Oberkirch | Owner: Ahmed
Type: | Ibrahim
Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: 5.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Claude Paroz):

Note that I provided a [https://github.com/django/django/pull/18725 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.
--
Ticket URL: <https://code.djangoproject.com/ticket/35281#comment:13>

Django

unread,
Jul 17, 2025, 1:52:11 AMJul 17
to django-...@googlegroups.com
#35281: Use HTTP 413 status code for RequestDataTooBig
-------------------------------------+-------------------------------------
Reporter: Milan Oberkirch | Owner: Claude
Type: | Paroz
Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: 5.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ahmed Ibrahim):

* has_patch: 0 => 1
* owner: Ahmed Ibrahim => Claude Paroz

Comment:

Replying to [comment:13 Claude Paroz]:
> Note that I provided a [https://github.com/django/django/pull/18725 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.

I'm open to leaving the ticket for you since you like it, I've re-assigned
it to you, please, re-assign back in case that's not to your liking, just
so you know, you need to mark it as `has patch` for it to be in review,
and in this specific instance, I did that to save your time.
--
Ticket URL: <https://code.djangoproject.com/ticket/35281#comment:14>

Django

unread,
Nov 26, 2025, 4:29:48 PM (4 days ago) Nov 26
to django-...@googlegroups.com
#35281: Use HTTP 413 status code for RequestDataTooBig
-------------------------------------+-------------------------------------
Reporter: Milan Oberkirch | Owner: Claude
Type: | Paroz
Cleanup/optimization | Status: assigned
Component: HTTP handling | Version: 5.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Wes P.):

* needs_better_patch: 0 => 1

Comment:

The WIP PR goes beyond the scope of this ticket (code refactoring with
deprecation). I recommend that either this ticket be revised to reflect
the need to refactor the existing functionality or for a new ticket to be
created.
--
Ticket URL: <https://code.djangoproject.com/ticket/35281#comment:15>
Reply all
Reply to author
Forward
0 new messages