Re: [squid-users] help with squid redirectors

From: Marcus Kool <marcus.kool_at_urlfilterdb.com>
Date: Sun, 13 Mar 2011 21:27:44 -0300

Osmany,
look in access.log.
It should say what is happening:
I expect this:
... TCP_MISS/301 GET http://kaspersky....
... TCP_MISS/200 GET ftp://dnl-kaspersky.quimefa.cu:2122/Updates

and does the client use Squid for the ftp protocol ??

And the RE matches too many strings.
I recommend to rewrite it to something like this:

    if ($url =~ /^http:\/\/dnl.*\.kaspersky\.com\/(.*)/) {
       my $newurl;
       $newurl = "ftp:\/\/dnl-kaspersky\.quimefa\.cu\:2122\/Updates/$1"; # Note the $1
       print $X[0]." 301:$newurl\n";
    }

Marcus

Osmany wrote:
> So finally this is what I have and it works perfectly. But I want to go
> further than this. I want the clients to download what they've requested
> from my local urls. For example...if a client wants to update their
> Kaspersky antivirus and it requests for an internet update server, I
> want it to actually get redirected to my ftp and download what it wants
> from here. So far what I've accomplished is that any request gets
> redirected to the specified url but it doesn't follow the path of the
> file that the client requested.
>
> #!/usr/bin/perl
> BEGIN {$|=1}
> while (<>) {
> @X = split;
> $url = $X[1];
> if ($url =~ /^http:\/\/(.*)kaspersky(.*)/) {
> print $X[0]." 301:ftp:\/\/dnl-kaspersky\.quimefa\.cu\:2122\/Updates
> \n";
> }
> elsif ($url =~ /^http:\/\/(.*)update(.*)/) {
> print $X[0]." 301:http:\/\/windowsupdate\.quimefa\.cu\:8530\n";
> }
> else {
> print $X[0]."\n";
> }
> }
>
> Can anybody help me with this?
>
>
>
Received on Mon Mar 14 2011 - 00:27:51 MDT

This archive was generated by hypermail 2.2.0 : Mon Mar 14 2011 - 12:00:02 MDT