[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Banner exchange

Craig Sanders wrote:
> On Wed, 18 Feb 1998, Behan Webster wrote:
> > When you first posted about this, I setup our squid server in a
> > similar fashion.  I too have modified your script extensively, but we
> > use a 32x32 grey gif.  That is just so there is something to fill the
> > spot that would normally be an ad, and sinde it's all one color it can
> > be forced to whatever size without looking strange.
> the one pixel gif works nicely.  all banner ads (that i've seen) have width
> and height tags so the 1 pixel gif gets stretched appropriately.

Some of the pages we go to don't have height and width specified for
banners, so a small default size helps for us.  Otherwise, I would agree
that a one pixel gif would be sufficient.  We like the matt grey so that
people know there would have been something there had it not been

> I'd implement this by running a second squid. either on a separate
> machine, or on the same machine with a different config file on a
> different port. in both cases, the banner blocking squid would have only
> a tiny (under 100mb) cache and use the main cache as the parent,

This is possible, but not worth it for a single individual.

> > I would love to see your current incarnation of your script, and would
> > be happy to post ours if you'd like to see it.
> I'd be very interested in seeing your version.  There may be some
> improvements/ideas I can add into mine.

Sure thing.  It's included at the end of this email.  It's not nearly as
complex as your current system.

> I've decided I'm going to clean up the script and package it.  But
> it brings up a few questions. the redir db should be renamed to
> /etc/squid/redir or something like that, but where do i put the
> generated perl script? /usr/lib/squid/squid.redir is what i am doing
> now....but a package shouldn't assume that /usr is rw, it might be
> mounted ro. would /var/lib/squid be appropriate?

I would suggest /etc/squid.  But that's just me.  I suspect that
/var/lib/squid is probably the appropriate place.  (Of course the flip
side of that is that some people would like to mount /var noexec...)

> > I like animated gifs, but not as ads.  Then they are extremely annoying!
> i could ignore the banner ads until they started animating them. that
> was too much. distracts from the content (an unforgiveable crime). so i
> did something about it :-)

I agree.


Behan Webster     mailto:behanw@verisim.com
+1-613-224-7547   http://www.verisim.com/

# Redirect filter for squid
# Written by: Behan Webster <behanw@pobox.com>
# Based on script by: Craig Sanders

# Default blank picture
my $blank = '//doc/images/blank.gif';
my $pic = '(gif|jpg|jpeg|png)$';

# Don't redirect for these IP addresses
my @except = (

# Redirect the following
%redir = (
#"//.*/ad/.*$pic"                                   => $blank,
"//.*/ads/.*$pic"                                   => $blank,
"//.*/advert.*$pic"                                 => $blank,
"//.*/inserts/.*$pic"                               => $blank,
#"//.*/promo.*$pic"                                 => $blank,
'//.*ad.preferences.com/.*'                         => $blank,
'//.*adserver.sympatico.ca/image.ng.*'              => $blank,
'//.*boardwatch.com/banner/.*'                      => $blank,
'//.*doubleclick.net/ad/.*'                         => $blank,
'//.*doubleclick.net/adi/.*'                        => $blank,
'//.*doubleclick.net/click.*'                       => $blank,
'//.*excite.com/img/.*/promo/.*'                    => $blank,
'//.*i8.net/worldnet/ad.cgi.*'                      => $blank,
'//.*infoseek.com/doc/sponsors/images/.*'           => $blank,
'//.*internic.net/images/banner/.*'                 => $blank,
'//.*mcp.com/ad_banners/.*'                         => $blank,
'//.*news.com/Banners/Images/.*'                    => $blank,
'//.*ottawakiosk.com/banners/.*'                    => $blank,
'//.*riddler.com/Commonwealth/bin/statdeploy.*'     => $blank,
'//.*secapl.com/qsImages/.*'                        => $blank,
'//.*shareware.com/Banners/Images/.*'               => $blank,
'//.*tucows.wire.net.au/images/adds/.*'             => $blank,
'//.*valueclick.com/cgi-bin/cycle.*'                => $blank,
'//.*yahoo.com/adv/.*'                              => $blank,
'//.*yahoo.com/promotions/.*'                       => $blank,

# Make exception list
foreach ( @except ) {
    #($name, $aliases, $addrtype, $length, @addrs) = gethostbyname( $_
    @_ = gethostbyname( $_ );
    push( @ip, join(".", unpack('C4', $_[4]) ) );

# Event loop
while( <> ) {

    # URL ip-address/fqdn ident method
    my ($url, $address, $ident, $method) = split;

    # See if request came from ip who wants advertisements
    $address =~ s|/.*$||;
    @_ = grep( /$address/, @ip );
    if( $#_ < 0 ) {

        # See if the url is an advertisement
        foreach ( keys %redir ) {
            if( $url =~ s/$_/$redir{$_}/i ) {
                print $url;

    print "\n";

TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .

Reply to: