Opened 15 years ago
Closed 15 years ago
#15066 closed (duplicate)
GzipMiddleware does not work with generator-created responses
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Uncategorized | Version: | dev |
| Severity: | Keywords: | gzip | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
With a response like
def gen():
yield "something"
return HttpResponse(gen())
and a HTTP 200 status code, the GzipMiddleware will always return an empty response because it accesses the response.content property twice. That means the _get_content getter applies ''.join twice to the generator, but a generator can only be iterated once.
See patch proposal.
Attachments (1)
Note:
See TracTickets
for help on using tickets.
Simple patch