mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Issue #16220: wsgiref now always calls close() on an iterable response.
Patch by Brent Tubbs.
This commit is contained in:
parent
c859bd2b28
commit
e97a24d06a
4 changed files with 30 additions and 36 deletions
|
@ -122,11 +122,13 @@ class BaseHandler:
|
|||
in the event loop to iterate over the data, and to call
|
||||
'self.close()' once the response is finished.
|
||||
"""
|
||||
if not self.result_is_file() or not self.sendfile():
|
||||
for data in self.result:
|
||||
self.write(data)
|
||||
self.finish_content()
|
||||
self.close()
|
||||
try:
|
||||
if not self.result_is_file() or not self.sendfile():
|
||||
for data in self.result:
|
||||
self.write(data)
|
||||
self.finish_content()
|
||||
finally:
|
||||
self.close()
|
||||
|
||||
|
||||
def get_scheme(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue