changeset 2933:5ad34b3541e6

only set Expires: header once for cache disabling
author Johannes Berg <johannes AT sipsolutions DOT net>
date Tue, 30 Oct 2007 14:34:57 +0100
parents 27d192ebd485
children 2521eb511f77
files MoinMoin/request/__init__.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/request/__init__.py	Tue Oct 30 14:30:57 2007 +0100
+++ b/MoinMoin/request/__init__.py	Tue Oct 30 14:34:57 2007 +0100
@@ -1548,9 +1548,12 @@
         elif level == 2:
             self.setHttpHeader('Cache-Control: no-cache')
 
-        # Set Expires for http 1.0 caches (does not support Cache-Control)
-        when = time.time() - (3600 * 24 * 365)
-        self.setHttpHeader('Expires: %s' % self.httpDate(when=when))
+        # only do this once to avoid 'duplicate header' warnings
+        # (in case the caching disabling is being made stricter)
+        if not self.http_caching_disabled:
+            # Set Expires for http 1.0 caches (does not support Cache-Control)
+            when = time.time() - (3600 * 24 * 365)
+            self.setHttpHeader('Expires: %s' % self.httpDate(when=when))
 
         # Set Pragma for http 1.0 caches
         # See http://www.cse.ohio-state.edu/cgi-bin/rfc/rfc2068.html#sec-14.32