Opened 11 years ago

Closed 11 years ago

#5165 closed (invalid)

HttpResponse's flush method does not do anything

Reported by: arthur.vuillard@… Owned by: Malcolm Tredinnick
Component: HTTP handling Version: master
Severity: Keywords: httpresponse flush
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


HttpResponse flush method should flush the content previously written by the write method to the socket but this method doesn't do anything :

def flush(self):


This method should be really useful in some Ajax web application.

Change History (2)

comment:1 Changed 11 years ago by Simon G. <dev@…>

Triage Stage: UnreviewedAccepted

comment:2 Changed 11 years ago by Malcolm Tredinnick

Resolution: invalid
Status: newclosed

HttpResponse classes are agnostic about the downstream communication method. So there's no concept of a socket or network connection for it to flush. I think you're trying to solve some problem with the wrong abstraction here. Comet-style data streaming and trying to have fine-grained control over output chunking would need attention in the HTTP handlers area, not in this class.

The only reason HttpResponse has a flush() method at all is because we need it to behave as a file-like object and some applications require flush() to exist (although it need not do anything, as noted by the Python docs).

You might wish to raise whatever problem you are trying to solve on django-users to get some ideas about how to handle it.

Note: See TracTickets for help on using tickets.
Back to Top