[patch] HttpResponse should support close() for iterators
|Reported by:||Owned by:||Adrian Holovaty|
|Cc:||Maniac@…, Malcolm Tredinnick||Triage Stage:||Unreviewed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
WSGI kinda suggests that a server should call 'close()' method of after getting content from a response iterator if it has one. This is very logical since one of the most common examples of an iterator is a file and it really should be closed afterwards. And incidentally 'flup' which is commonly used to run FastCGI server indeed does this.
The problem is that our HttpResponse wraps the actual iterator into a generator (for unicode conversion). And this generator doesn't have 'close()' method and hence the iterator never closed.
I've rewrote this to handle 'close()', patch follows.
Change History (7)
comment:2 Changed 10 years ago by
|Summary:||HttpResponse should support close() for iterators → [patch] HttpResponse should support close() for iterators|