mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed #16241 -- Ensured the WSGI iterable's close() is always called.
Thanks Graham Dumpleton for the report.
This commit is contained in:
		| @@ -109,6 +109,17 @@ class ServerHandler(simple_server.ServerHandler, object): | ||||
|         super(ServerHandler, self).error_output(environ, start_response) | ||||
|         return ['\n'.join(traceback.format_exception(*sys.exc_info()))] | ||||
|  | ||||
|     # Backport of http://hg.python.org/cpython/rev/d5af1b235dab. See #16241. | ||||
|     # This can be removed when support for Python <= 2.7.3 is deprecated. | ||||
|     def finish_response(self): | ||||
|         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() | ||||
|  | ||||
|  | ||||
| class WSGIServer(simple_server.WSGIServer, object): | ||||
|     """BaseHTTPServer that implements the Python WSGI protocol""" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user