#29427: RequestDataTooBig raised in request.py prevents Middleware from
returning a
valid response
-------------------------------+------------------------------------
Reporter: S. Paquette | Owner: nobody
Type: Bug | Status: new
Component: HTTP handling | Version: 1.11
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 S. Paquette):
Replying to [comment:1 Claude Paroz]:
> Seems legitimate. Would you be able to write a failing test for the
Django test suite?
Sure thing--how's this look for django/tests/requests/tests.py?
{{{
from django.core.exceptions import RequestDataTooBig
def test_req_body_exists_after_size_exceeded(self):
"""
If a CONTENT_LENGTH > DATA_UPLOAD_MAX_MEMORY_SIZE is encountered,
an empty
_body attribute should still be generated in the request
"""
with override_settings(DATA_UPLOAD_MAX_MEMORY_SIZE=12):
payload = FakePayload('a=1&a=2;a=3\r\n')
request = WSGIRequest({
'REQUEST_METHOD': 'POST',
'CONTENT_TYPE': 'application/x-www-form-
urlencoded',
'CONTENT_LENGTH': len(payload),
'wsgi.input': payload,
})
with self.assertRaises(RequestDataTooBig):
request.body
self.assertTrue(hasattr(request,'_body'))
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29427#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.6ac03c8b2600c5dd2fe679a1bd6d5b8f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.