From: Ben Darnell Date: Thu, 28 Oct 2010 04:23:29 +0000 (-0700) Subject: Don't manually set Content-Length in StaticFileHandler. X-Git-Tag: v1.2.0~89 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b914a94ac24c6e09003b29bc4919d028a042ed25;p=thirdparty%2Ftornado.git 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. --- diff --git a/tornado/web.py b/tornado/web.py index 6507d7083..83521ace0 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())