From b914a94ac24c6e09003b29bc4919d028a042ed25 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Wed, 27 Oct 2010 21:23:29 -0700 Subject: [PATCH] Don't manually set Content-Length in StaticFileHandler. Content-Length will be set automatically in RequestHandler.finish. This change fixes a bug in which RequestHandler.finish's Etag support strips the response body without changing any headers. Transfer headers (including Content-Length and Transfer-Encoding) are the responsibility of the framework, not the "application-level" handlers (which includes StaticFileHandler). Closes #160. --- tornado/web.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tornado/web.py b/tornado/web.py index 6507d708..83521ace 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -1284,7 +1284,6 @@ class StaticFileHandler(RequestHandler): if not include_body: return - self.set_header("Content-Length", stat_result[stat.ST_SIZE]) file = open(abspath, "rb") try: self.write(file.read())