changeset 5206:64854adb52fc

add Expires header with now + 10 seconds for AttachFile do=get and do=box User's browser shall usually request the wiki content as it might change fast. It'll either get a 200 OK response with the content, or (if content was not modified) a 304 NOT MODIFIED response. Without the Expires header, browser does not request the content (I guess it uses some builtin heuristics then to determine when to do a request, and that that might be much too slow for fast changing wikis).
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 10 Oct 2009 15:54:36 +0200
parents bc5d4e7072ea
children 26b7f7f8bfe7
files MoinMoin/action/AttachFile.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Sat Oct 10 15:42:17 2009 +0200
+++ b/MoinMoin/action/AttachFile.py	Sat Oct 10 15:54:36 2009 +0200
@@ -782,6 +782,8 @@
         request.headers.add('Date', http_date(now))
         request.headers.add('Content-Type', content_type)
         request.headers.add('Last-Modified', http_date(timestamp))
+        # Expire content fast, browser shall ask and get 200 or 304 answer:
+        request.headers.add('Expires', http_date(now + 10))
         #request.headers.add('Content-Length', os.path.getsize(fpath))
         content_dispo_string = '%s; filename="%s"' % (content_dispo, filename_enc)
         request.headers.add('Content-Disposition', content_dispo_string)
@@ -822,6 +824,8 @@
         request.headers.add('Date', http_date(now))
         request.headers.add('Content-Type', content_type)
         request.headers.add('Last-Modified', http_date(timestamp))
+        # Expire content fast, browser shall ask and get 200 or 304 answer:
+        request.headers.add('Expires', http_date(now + 10))
         request.headers.add('Content-Length', os.path.getsize(fpath))
         content_dispo_string = '%s; filename="%s"' % (content_dispo, filename_enc)
         request.headers.add('Content-Disposition', content_dispo_string)