changeset 941:16f7b6728b4e

move vary: header code to request module and fix it (multiple headers of same type don't work!)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 16 Jul 2006 14:58:21 +0200
parents 595a285e634c
children 86ea8f868030
files MoinMoin/Page.py MoinMoin/i18n/__init__.py MoinMoin/request/__init__.py
diffstat 3 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Sun Jul 16 13:51:22 2006 +0200
+++ b/MoinMoin/Page.py	Sun Jul 16 14:58:21 2006 +0200
@@ -1158,12 +1158,6 @@
         if not content_only:
             # send the document leader
 
-            # need to inform caches that content changes
-            # based on cookie (even if we aren't sending one now)
-            request.setHttpHeader("Vary: Cookie")
-            # we include User-Agent because a bot might be denied and get no content
-            request.setHttpHeader("Vary: User-Agent")
-
             # use "nocache" headers if we're using a method that
             # is not simply "display", or if a user is logged in
             # (which triggers personalisation features)
--- a/MoinMoin/i18n/__init__.py	Sun Jul 16 13:51:22 2006 +0200
+++ b/MoinMoin/i18n/__init__.py	Sun Jul 16 14:58:21 2006 +0200
@@ -284,8 +284,6 @@
     if not request.cfg.language_ignore_browser:
         for lang in browserLanguages(request):
             if lang in available:
-                if request.http_accept_language:
-                    request.setHttpHeader('Vary: Accept-Language')
                 return lang
 
     # Or return the wiki default language...
--- a/MoinMoin/request/__init__.py	Sun Jul 16 13:51:22 2006 +0200
+++ b/MoinMoin/request/__init__.py	Sun Jul 16 14:58:21 2006 +0200
@@ -1047,6 +1047,15 @@
             else:
                 pagename = None
 
+            # need to inform caches that content changes based on:
+            # * cookie (even if we aren't sending one now)
+            # * User-Agent (because a bot might be denied and get no content)
+            # * Accept-Language (except if moin is told to ignore browser language)
+            if self.cfg.language_ignore_browser:
+                self.setHttpHeader("Vary: Cookie User-Agent")
+            else:
+                self.setHttpHeader("Vary: Cookie User-Agent Accept-Language")
+
             # Handle request. We have these options:
             # 1. If user has a bad user name, delete its bad cookie and
             # send him to UserPreferences to make a new account.