From 8a3b3c46a29077106c68062c54a43e3dddb9c064 Mon Sep 17 00:00:00 2001 From: Christian Hofstaedtler Date: Wed, 21 Dec 2011 01:07:43 +0100 Subject: [PATCH] use download/bounce instead of download.cgi --- cgi-bin/download.cgi | 69 ------------------------------------------- cgi-bin/index.html | 1 - download/index.php | 2 +- download/prerelease/index.php | 2 +- 4 files changed, 2 insertions(+), 72 deletions(-) delete mode 100755 cgi-bin/download.cgi delete mode 100644 cgi-bin/index.html diff --git a/cgi-bin/download.cgi b/cgi-bin/download.cgi deleted file mode 100755 index 57d1b20..0000000 --- a/cgi-bin/download.cgi +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/python - -current_version = "2010.04" -mirror_url = "http://download.grml.org/" - -#### END OF CONFIGURATION #### - -import cgi, re - -safe_regex = re.compile('^[a-zA-Z0-9_]+$') - -def validate_input(value): - x = safe_regex.match(value) - if not x: - raise Exception("unsafe input found" + str(x)) - return value - -def get_download_url(flavour, arch, filetype): - folder = '' - product = 'grml' - if arch == "amd64": product = 'grml64' - if flavour == 'full': - pass - else: - product += '-' + flavour - - filetypes = { - 'iso': '', - 'bt': '.torrent', - 'md5': '.md5', - 'sha1': '.sha1', - 'signature': '.sha1.asc' - } - fileext = filetypes[filetype] - if "rc" in current_version: - folder = "devel/" - - iso = product + '_' + current_version + '.iso' + fileext - return mirror_url + folder + iso - -def run(): - import cgitb - cgitb.enable() - - try: - form = cgi.FieldStorage() - try: - global current_version - current_version = form['version'].value - except Exception: - pass - flavour = validate_input(form['flavour'].value) - arch = validate_input(form['arch'].value) - filetype = "iso" - if "filetype" in form: filetype = validate_input(form['filetype'].value) - - print "Status: 302" - print "Location: " + get_download_url(flavour, arch, filetype) - print - except Exception, e: - print "Content-Type: text/html" # HTML is following - print # blank line, end of headers - print "

Error

" - print "Please select flavour and architecture." - print e - -if __name__ == "__main__": - run() - diff --git a/cgi-bin/index.html b/cgi-bin/index.html deleted file mode 100644 index 257cc56..0000000 --- a/cgi-bin/index.html +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/download/index.php b/download/index.php index aa76259..3b273dd 100644 --- a/download/index.php +++ b/download/index.php @@ -102,7 +102,7 @@