Set Vary: Cookie and No-Vary-Search: key-order headers. Closes issue #20

This commit is contained in:
Jean-Francois Dockes 2025-11-25 09:22:53 +01:00
parent fb37658e74
commit ed0737b1d3

View file

@ -429,6 +429,7 @@ def server_static(path):
@bottle.view('main')
def main():
config = get_config()
bottle.response.headers['Vary'] = 'Cookie'
return { 'dirs': get_dirs(config['dirs'], config['dirdepth']),
'query': get_query(config), 'sorts': SORTS, 'config': config}
#}}}
@ -444,6 +445,8 @@ def results():
config['maxresults'] = nres
if config['perpage'] == 0:
config['perpage'] = nres
bottle.response.headers['Vary'] = 'Cookie'
bottle.response.headers['No-Vary-Search'] = 'key-order'
return { 'res': res, 'time': timer, 'query': query, 'dirs':
get_dirs(config['dirs'], config['dirdepth']),
'qs': qs, 'sorts': SORTS, 'config': config,
@ -482,6 +485,8 @@ def preview(resnum):
txt
bottle.response.content_type = 'text/html; charset=utf-8'
return txt
bottle.response.headers['Vary'] = 'Cookie'
bottle.response.headers['No-Vary-Search'] = 'key-order'
return tdoc.text
#}}}
#{{{ download
@ -509,6 +514,8 @@ def edit(resnum):
os.unlink(path)
except:
pass
bottle.response.headers['Vary'] = 'Cookie'
bottle.response.headers['No-Vary-Search'] = 'key-order'
return f
#}}}
#{{{ json
@ -517,6 +524,8 @@ def get_json():
config = get_config()
query = get_query(config)
qs = query_to_recoll_string(query)
bottle.response.headers['Vary'] = 'Cookie'
bottle.response.headers['No-Vary-Search'] = 'key-order'
bottle.response.headers['Content-Type'] = 'application/json'
bottle.response.headers['Content-Disposition'] = \
'attachment; filename=recoll-%s.json' % normalise_filename(qs)
@ -538,6 +547,8 @@ def get_csv():
query['page'] = 0
query['snippets'] = 0
qs = query_to_recoll_string(query)
bottle.response.headers['Vary'] = 'Cookie'
bottle.response.headers['No-Vary-Search'] = 'key-order'
bottle.response.headers['Content-Type'] = 'text/csv'
bottle.response.headers['Content-Disposition'] = \
'attachment; filename=recoll-%s.csv' % normalise_filename(qs)