Commit 317a3c52 authored by Peter Palfrader's avatar Peter Palfrader

Allow http redirecting files to /file/ links

parent 5703fb8f
......@@ -49,6 +49,8 @@ expires.package.root_cat = 600
expires.package.source = 600
expires.package.source_version = 600
http_redirect_to_farm_files = true
#expires.package.mr.list = 300
#expires.package.mr.source = 300
#expires.package.mr.source_version = 300
......
......@@ -138,6 +138,12 @@ class ArchiveController(BaseController):
return render('/archive-runs.mako')
def _regular_file(self, digest, visiblepath=None):
# just send a redirect. And let the caching header follow it.
# (not all apt clients do http redirects)
if config['app_conf']['http_redirect_to_farm_files'] and visiblepath is not None:
return redirect("/file/%s"%(digest,))
try:
realpath = app_globals.shm.get_filepath(digest)
fa = SnapshotFileApp(realpath, digest, visiblepath)
......
......@@ -62,6 +62,8 @@ class Globals(object):
defaults['snapshot.domain'] = 'snapshot.debian.org'
defaults['snapshot.masterdomain'] = 'snapshot-master.debian.org'
defaults['http_redirect_to_farm_files'] = False
for key in defaults:
if not key in config['app_conf']: config['app_conf'][key] = defaults[key]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment