At 18:33 02/02/98 , Lauri Laupmaa wrote:
>Hi
>
>How could one squid user replace standard size ads from doubleclick,
>etc with some fixed size bitmap ???
>
>Has anyone written redirector to do it ?
Here is what I used with some success:
#!/usr/bin/awk -f
#
# rediradds.awk
# feel free to reuse, modify, etc..
#
{
if ( ($1 ~
/((\/|\.|\?|=|_)(accipiter|ad|AD|ads([0-9])*|ADS|adverts|advertising|adjuggl
er|banner|sponsor)(\.|\/|\?|=|_))/ ) &&
( ($1 !~ /\.htm/) && ($2 !~ "ip1.ip1.ip1.ip1/") && ($2 !~
"ip2.ip2.ip2.ip2/") ) )
print "http://www/squid/removed.gif"|"cat";
else
print ""|"cat";
fi
}
I couldn't find why I need these 'cat'. When I remove them, squid act as if
the redirector didn't write anything. But when I test the script with or
without 'cat', it ouputs the same things! If someone could explain me...
The ($2 !~ ...) are there because two people don't want their ads filtered.
The 'removed.gif' is a 468x60x16 gif. I began with a transparent one, but I
think users want to know what the proxy removes. I replaced it with
something visible, but with quiet gray colors.
It seems rather fast (squid reports a 1ms avg service time on a P90, which
is the smallest it can report I believe) but I couldn't test it under heavy
load.
-----------------------------------
Relevant to redirectors:
I have proposed one project for second year students in our school :
build a redirector which would allow interaction with the clients (for the
moment (de)activation of ads filter).
They must build
- a new redirector which takes a file with a regexp (the filter) and a file
with a list of IP-adresses (for which the redirector must activate the
filter) and reloads them when it receives a given signal.
- a server which will run on squid's host, receiving clients's requests,
writing to the IP-adresses file and sending the given signal to the
redirector when needed.
- a set of clients for various platforms, based on a UNIX command-line
version (in order to have a simple source base).
If it works I will post the results. (Should be done in 2 months).
Gyver.
_____________________________________________
Lionel Bouton
French student @ Supelec
E-mail : Lionel.Bouton@supelec.fr
Snail-mail : 4, place Edouard Branly
57070 Metz (France)
_____________________________________________
Received on Mon Feb 02 1998 - 11:27:09 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:38:40 MST