]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - config/updxlrator/updxlrator
Fix bug 10504: match download's sourceurl mangling in, updxlrator
[ipfire-2.x.git] / config / updxlrator / updxlrator
index 4aaa38938c5473a40ce481822e9c46229a1c3cd7..b728902f6d5207805f730f076fe390f92bdfd0fe 100644 (file)
@@ -8,6 +8,11 @@
 #
 # $Id: updxlrator,v 2.1 2009/01/10 00:00:00 marco.s Exp $
 #
+# ChangeLog:
+#
+# 2012-10-26: nightshift - move curly bracket to capture AVG download source.
+#                       - Adding BIG HINT for new update source#
+#
 
 use strict;
 use HTTP::Date;
@@ -65,7 +70,7 @@ while (<>) {
        $username   = $tmp[2]; if ($username eq '') { $username='-'; };
        $method     = $tmp[3];
 
-       $xlrator_url = $source_url;
+       $xlrator_url = "";
 
        if (($method eq 'GET') || ($method eq 'HEAD')) 
        {
@@ -75,8 +80,8 @@ while (<>) {
        # -----------------------------------------------------------
 
        if (
-           (($source_url =~ m@^http://[^/]*\.microsoft\.com/.*\.(exe|psf|msi|msp|cab)$@i) ||
-            ($source_url =~ m@^http://[^/]*\.windowsupdate\.com/.*\.(exe|psf|msi|msp|cab)$@i))
+           (($source_url =~ m@^http://[^/]*\.microsoft\.com/.*\.(exe|psf|msi|msp|msu|cab)$@i) ||
+            ($source_url =~ m@^http://[^/]*\.windowsupdate\.com/.*\.(exe|psf|msi|msp|msu|cab)$@i))
        &&   ($source_url !~ m@^http://[^/]*\.microsoft\.com/.*(/autoupd|selfupdate/).*\.cab@i)
        &&   ($source_url !~ m@\&@)
           )
@@ -88,6 +93,7 @@ while (<>) {
        #  Section: Adobe Downloads
        # -----------------------------------------------------------
 
+
        if (
            ($source_url =~ m@^http://(ar)?download\.adobe\.com/.*\.(exe|msi|bin|dmg|idx|gz)$@i) ||
            ($source_url =~ m@^http://swupdl\.adobe\.com/updates/.*\.(exe|msi|bin|dmg|idx|gz|[a-z][a-z]_[A-Z][A-Z])$@i) ||
@@ -102,8 +108,8 @@ while (<>) {
        # -----------------------------------------------------------
 
        if (
-               ($source_url =~ m@^[h|f]t?tp://[^?]+\.(deb|rpm)$@i) ||
-               ($source_url =~ m@^[h|f]t?tp://[^?]+/distfiles/[^?]+\.(tar\.gz|tar\.bz2|tgz|zip|patch\.bz2|gz|docx|patch|pdf|exe)$@i)
+               ($source_url =~ m@^[h|f]t?tp://[^?]+\.(pkg\.tar\.xz|deb|rpm)$@i) ||
+               ($source_url =~ m@^[h|f]t?tp://[^?]+/distfiles/[^?]+\.(tar\.gz|tar\.bz2|tar\.xz|tgz|zip|patch\.bz2|gz|docx|patch|pdf|exe)$@i)
        )
        {
                $xlrator_url = &check_cache($source_url,$hostaddr,$username,"Linux",$mirror);
@@ -149,13 +155,29 @@ while (<>) {
        #  Section: Avast Downloads
        # -----------------------------------------------------------
 
-       if ($source_url =~ m@^http://download[\d]+\.avast\.com/.*\.(exe|vpu)$@i)
+       if ($source_url =~ m@^http://(ion|download)[\d]+\.avast\.com/.*\.(exe|vpu|vpx)$@i)
        {
                $xlrator_url = &check_cache($source_url,$hostaddr,$username,"Avast",$mirror);
        }
 
+        # -----------------------------------------------------------
+        #  Section: Mozilla Downloads
+        # -----------------------------------------------------------
+
+       if ($source_url=~ m@^http://.*\.mozilla\.net/.*\.((complete|partial)\.mar|exe)$@i)
+       { 
+               $xlrator_url = &check_cache($source_url,$hostaddr,$username,"Mozilla",$unique);
+       }
+
+       # -----------------------------------------------------------
+       #  Section: Mcafee
        # -----------------------------------------------------------
        
+       if ($source_url =~ m@^http://update\.nai\.com/.*\.(mcs|z|gem|dat|zip)$@i)
+       {
+               $xlrator_url = &check_cache($source_url,$hostaddr,$username,"mcafee",$mirror);
+       }
+       
        # -----------------------------------------------------------
        # Section: Avira Downloads
        # -----------------------------------------------------------
@@ -178,8 +200,6 @@ while (<>) {
                $xlrator_url = &check_cache($source_url,$hostaddr,$username,"IPFire",$mirror);
        }
 
-       }
-       
        # -----------------------------------------------------------
        # Section: AVG Downloads
        # -----------------------------------------------------------
@@ -189,9 +209,14 @@ while (<>) {
 #              $xlrator_url = &check_cache($source_url,$hostaddr,$username,"AVG",$mirror);
 #      }
 
-       $request="$xlrator_url $hostaddr $username $method\n";
+# ----------- ADD NEW SOURCES BEFORE THIS LINE !!! ------------------
+       }
 
-       print $request;
+       if ($xlrator_url) {
+               print "OK rewrite-url=\"$xlrator_url\"\n";
+       } else {
+               print "ERR\n";
+       }
 }
 
 # -------------------------------------------------------------------
@@ -320,7 +345,9 @@ sub check_cache
        my $sourceurl=$_[0];
        my $cfmirror=$_[4];
 
+       $sourceurl =~ s@\%2b@+@ig;
        $sourceurl =~ s@\%2f@/@ig;
+       $sourceurl =~ s@\%7e@~@ig;
        $updfile = substr($sourceurl,rindex($sourceurl,"/")+1);
        $updfile =~ s@\%20@ @ig;