]> git.ipfire.org Git - people/shoehn/ipfire.org.git/commitdiff
Support HEAD for download redirects.
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 27 Aug 2012 15:03:13 +0000 (17:03 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 27 Aug 2012 15:03:13 +0000 (17:03 +0200)
www/webapp/handlers_download.py

index f6416ce3c1d5c1f31ebfa0c3dbfc2ba9762c5576..e45f5028c39b22b37cc3eac9cb2e415e88636a31 100644 (file)
@@ -67,7 +67,7 @@ class DownloadDevelopmentHandler(BaseHandler):
 
 
 class DownloadFileHandler(BaseHandler):
-       def get(self, filename):
+       def head(self, filename):
                self.set_header("Pragma", "no-cache")
 
                # Get all mirrors...
@@ -88,6 +88,10 @@ class DownloadFileHandler(BaseHandler):
 
                self.redirect(mirror.url + filename[len(mirror.prefix):])
 
+       def get(self, filename):
+               return self.head(filename)
+
+               # Record the downlaod.
                country_code = self.geoip.get_country(self.request.remote_ip)
                self.mirrors.db.execute("INSERT INTO log_download(filename, mirror, country_code) VALUES(%s, %s, %s)",
                        filename, mirror.id, country_code)