Mercurial > moin > 1.9
changeset 5199:1992db92a230
fix '304 not modified' response for AttachFile do=get and do=box
author | Thomas Waldmann <tw AT waldmann-edv DOT de> |
---|---|
date | Sat, 10 Oct 2009 13:35:03 +0200 |
parents | 012f21c4c04e |
children | a3c6d7b7a5dd |
files | MoinMoin/action/AttachFile.py |
diffstat | 1 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py Thu Oct 08 09:10:57 2009 +0200 +++ b/MoinMoin/action/AttachFile.py Sat Oct 10 13:35:03 2009 +0200 @@ -30,6 +30,8 @@ import os, time, zipfile, errno, datetime from StringIO import StringIO +from werkzeug import http_date + from MoinMoin import log logging = log.getLogger(__name__) @@ -776,9 +778,11 @@ dangerous = mime_type in request.cfg.mimetypes_xss_protect content_dispo = dangerous and 'attachment' or 'inline' - request.content_type = content_type - request.last_modified = timestamp - #request.content_length = os.path.getsize(fpath) + now = time.time() + request.headers.add('Date', http_date(now)) + request.headers.add('Content-Type', content_type) + request.headers.add('Last-Modified', http_date(timestamp)) + #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) @@ -814,9 +818,11 @@ dangerous = mime_type in request.cfg.mimetypes_xss_protect content_dispo = dangerous and 'attachment' or 'inline' - request.content_type = content_type - request.last_modified = timestamp - request.content_length = os.path.getsize(fpath) + now = time.time() + request.headers.add('Date', http_date(now)) + request.headers.add('Content-Type', content_type) + request.headers.add('Last-Modified', http_date(timestamp)) + 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)