]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Allow StaticFileHandler subclasses to set additional headers on the response
authorBen Darnell <bdarnell@beaker.local>
Tue, 25 May 2010 21:36:50 +0000 (14:36 -0700)
committerBen Darnell <bdarnell@beaker.local>
Tue, 25 May 2010 21:36:50 +0000 (14:36 -0700)
tornado/web.py

index ea48044f1b378d8e8928f63795efcc94c929a11e..17289d55b1d15596900e26a351de09b158d7d333 100644 (file)
@@ -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.