From 686c1c5fd274277560393d3d5001d310fcaf6b2f Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sun, 18 Sep 2011 12:27:56 +0200 Subject: [PATCH] set caching header for images if appropriate --- browser/resource.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/browser/resource.py b/browser/resource.py index f468ac5..9d499eb 100644 --- a/browser/resource.py +++ b/browser/resource.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2010 Helmut Merz helmutm@cy55.de +# Copyright (c) 2011 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -195,6 +195,9 @@ class ResourceView(BaseView): if ct.startswith('text/') and not useAttachment: response.setHeader('Content-Type', 'text/html') return self.renderText(data, ct) + if ct.startswith('image/') and not useAttachment: + #response.setHeader('Cache-Control', 'public,max-age=86400') + response.setHeader('Cache-Control', 'max-age=86400') response.setHeader('Content-Type', ct) # set Last-Modified header modified = self.modifiedRaw