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:
parent
c1be85fcfe
commit
7ffb44237f
|
@ -1110,7 +1110,6 @@ class StaticFileHandler(RequestHandler):
|
||||||
modified = datetime.datetime.fromtimestamp(stat_result[stat.ST_MTIME])
|
modified = datetime.datetime.fromtimestamp(stat_result[stat.ST_MTIME])
|
||||||
|
|
||||||
self.set_header("Last-Modified", modified)
|
self.set_header("Last-Modified", modified)
|
||||||
self.set_header("Content-Length", stat_result[stat.ST_SIZE])
|
|
||||||
if "v" in self.request.arguments:
|
if "v" in self.request.arguments:
|
||||||
self.set_header("Expires", datetime.datetime.utcnow() + \
|
self.set_header("Expires", datetime.datetime.utcnow() + \
|
||||||
datetime.timedelta(days=365*10))
|
datetime.timedelta(days=365*10))
|
||||||
|
@ -1133,6 +1132,7 @@ class StaticFileHandler(RequestHandler):
|
||||||
|
|
||||||
if not include_body:
|
if not include_body:
|
||||||
return
|
return
|
||||||
|
self.set_header("Content-Length", stat_result[stat.ST_SIZE])
|
||||||
file = open(abspath, "r")
|
file = open(abspath, "r")
|
||||||
try:
|
try:
|
||||||
self.write(file.read())
|
self.write(file.read())
|
||||||
|
|
Loading…
Reference in New Issue