]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Don't manually set Content-Length in StaticFileHandler.
authorBen Darnell <ben@bendarnell.com>
Thu, 28 Oct 2010 04:23:29 +0000 (21:23 -0700)
committerBen Darnell <ben@bendarnell.com>
Thu, 28 Oct 2010 04:26:55 +0000 (21:26 -0700)
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

index 6507d70835b8eaf4c36c85b12dcb499ea9f78b8d..83521ace01545b004341893366a2697cbfb2d066 100644 (file)
@@ -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())