Merge remote-tracking branch 'lerks/master' into work

This commit is contained in:
Ben Darnell 2012-01-22 14:10:14 -08:00
commit 76dd88f1bc
1 changed files with 5 additions and 0 deletions

View File

@ -1519,6 +1519,11 @@ class StaticFileHandler(RequestHandler):
return return
if not include_body: if not include_body:
self.set_header("Content-Length", os.path.getsize(abspath))
with open(abspath, "rb") as file:
hasher = hashlib.sha1()
hasher.update(file.read())
self.set_header("Etag", '"%s"' % hasher.hexdigest())
return return
file = open(abspath, "rb") file = open(abspath, "rb")
try: try: