Commit e7032a3e authored by Denis Bilenko's avatar Denis Bilenko

pywsgi: first invoke iterator's close() then issue 500 internal error

parent a8d8384b
......@@ -436,12 +436,14 @@ class WSGIHandler(object):
try:
try:
self.run_application()
except:
self.handle_error(*sys.exc_info())
finally:
close = getattr(self.result, 'close', None)
if close is not None:
close()
self.wsgi_input._discard()
except:
self.handle_error(*sys.exc_info())
finally:
if hasattr(self.result, 'close'):
self.result.close()
self.wsgi_input._discard()
self.time_finish = time.time()
self.log_request()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment