[Django] #35673: When URL has 1000+ query parameters, and DEBUG=True, Django does not generate the error page correctly

6 views
Skip to first unread message

Django

unread,
Aug 13, 2024, 3:48:08 AM8/13/24
to django-...@googlegroups.com
#35673: When URL has 1000+ query parameters, and DEBUG=True, Django does not
generate the error page correctly
-------------------------------+-------------------------------------------
Reporter: Pēteris Caune | Type: Bug
Status: new | Component: Error reporting
Version: 5.1 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+-------------------------------------------
When the number of query parameters in URL exceeds
settings.DATA_UPLOAD_MAX_NUMBER_FIELDS, Django takes more than a second to
generate the error page and eventually returns HTTP 500 with a blank page.
The "manage.py runserver" output shows a long chain of exceptions,
delimited with "The above exception was the direct cause of the following
exception:" line.

To reproduce: start a new Django project, and place the following in
urls.py:

{{{
from django.http import HttpResponse
from django.urls import path


def index(request):
request.GET.getlist("a")
url = "/?" + "&".join([f"a={i}" for i in range(0, 1001)])
return HttpResponse(f"""<a href="{url}">Click me</a>""",
content_type="text/html")


urlpatterns = [
path("", index),
]
}}}

The problem is only triggered if

* DEBUG=True (otherwise, Django generates a HTTP 400 response with no
delay)
* If the view accesses request.GET
--
Ticket URL: <https://code.djangoproject.com/ticket/35673>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Reply all
Reply to author
Forward
0 new messages