* à la première interrogation ça redirige mais par le suite il
y a une boucle dans squid3 :(
# http://gofedora.com/how-to-write-custom-redirector-rewritor-plugin-squid-python/
import sys
+import re
def modify_url(line):
list = line.split(' ')
- #first element of the list is the URL
+ #on récupère le premier élement envoyé
old_url = list[0]
new_url = '\n'
- #take the decision and modify the URL if needed
- #do remember that the new_url should contain a '\n' at the end.
- if old_url.startswith('http://cm.archive'):
+
+ ubuntu_archive = re.compile('[a-z][a-z].archive.ubuntu.com')
+ if ubuntu_archive.search(old_url):
new_url = 'http://miroir.ndere.cm.refer.org' + new_url
return new_url