From: Ben Darnell Date: Tue, 25 May 2010 21:36:50 +0000 (-0700) Subject: Allow StaticFileHandler subclasses to set additional headers on the response X-Git-Tag: v1.0.0~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f8725c718e2614536bf48638b103f1fca033ba1;p=thirdparty%2Ftornado.git Allow StaticFileHandler subclasses to set additional headers on the response --- diff --git a/tornado/web.py b/tornado/web.py index ea48044f1..17289d55b 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -1164,6 +1164,8 @@ class StaticFileHandler(RequestHandler): if mime_type: self.set_header("Content-Type", mime_type) + self.set_extra_headers(path) + # Check the If-Modified-Since, and don't send the result if the # content has not been modified ims_value = self.request.headers.get("If-Modified-Since") @@ -1183,6 +1185,10 @@ class StaticFileHandler(RequestHandler): finally: file.close() + def set_extra_headers(self, path): + """For subclass to add extra headers to the response""" + pass + class FallbackHandler(RequestHandler): """A RequestHandler that wraps another HTTP server callback.