#7581: Middleware accessing HttpResponse.content breaks streaming HttpResponse
objects.
---------------------------------------------+------------------------------
Reporter: mrmachine | Owner: nobody
Status: new | Milestone: post-1.0
Component: Core framework | Version: SVN
Resolution: | Keywords: stream
HttpResponse
Stage: Design decision needed | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Comment (by mrmachine):
I agree that it would also be useful to be able to disable certain
middleware per `HttpResponse`. You are correct in saying that the way a
response is created won't always indicate which middleware we want to
disable. However, if a certain middleware CAN run without breaking a
content generator (e.g. GZip when not using WSGI), shouldn't it do so?
How would such a feature be implemented? Pass a list of middleware (e.g.
`['django.middleware.common.CommonMiddleware',
'django.middleware.gzip.GZipMiddleware']`)? That could be prone to error,
requiring people to remember which middleware are required to be removed
in order to preserve streaming functionality.
What about setting a boolean attribute `consume_generator` on
`HttpResponse` which defaults to `True`. If this is `True`, then the
generator is consumed immediately and replaced with the resulting content
string. If it's `False`, then either any middleware or partial
functionality within some middleware that can't work without consuming the
content generator are skipped?
--
Ticket URL: <http://code.djangoproject.com/ticket/7581#comment:9>
Django Code <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---