Don't set content-length in StaticFileHandler unless we're actually

sending the content.  Some browsers get confused by this (e.g. the
version of webkit embedded in fluid, but not the version used in chrome).
This commit is contained in:
Ben Darnell 2010-02-04 13:18:43 -08:00
parent c1be85fcfe
commit 7ffb44237f
1 changed files with 1 additions and 1 deletions

View File

@ -1110,7 +1110,6 @@ class StaticFileHandler(RequestHandler):
modified = datetime.datetime.fromtimestamp(stat_result[stat.ST_MTIME])
self.set_header("Last-Modified", modified)
self.set_header("Content-Length", stat_result[stat.ST_SIZE])
if "v" in self.request.arguments:
self.set_header("Expires", datetime.datetime.utcnow() + \
datetime.timedelta(days=365*10))
@ -1133,6 +1132,7 @@ class StaticFileHandler(RequestHandler):
if not include_body:
return
self.set_header("Content-Length", stat_result[stat.ST_SIZE])
file = open(abspath, "r")
try:
self.write(file.read())