#!/bin/sh # # John's No-ADS proxy script # http://www.schooner.com/~loverso/no-ads/ # loverso@schooner.com # # Copyright 1996-2003, John LoVerso. All Rights Reserved. # # Permission is given to distribute this file, as long as this # copyright message and author notice are not removed, and no # monies are exchanged. # # No responsibility is taken for any errors on inaccuracies inherent # either to the comments or the code of this program, but if reported # to me, then an attempt will be made to fix them. # # $Id: noproxy,v 1.11 2008/10/23 18:41:16 loverso Exp loverso $ # # This fakes an HTTP transaction by it just returning a canned response. # # Normally, this is run from inetd with this line in inetd.conf # (remember to "kill -HUP" the inetd process after changing that file) # # # no-ads proxy # 3421 stream tcp nowait nobody /usr/local/lib/www/noproxy noproxy # # 3421 is either an arbitrary TCP port number or TCP service name; # just make sure you use the same value in "no-ads.pac". # ############################################################################### # Pick one of the noproxy schemes and use it at the end ############################################################################### # # Just deny the connection # deny() { echo HTTP/1.0 501 No Ads Accepted echo "" } ############################################################################### # # Return redirection to "no-ads" image, # so you can tell when an ad is suppressed. # redir() { printf '%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n' \ "HTTP/1.0 301 No Ads Accepted" \ "Date: Mon, 20 Oct 1997 12:25:47 GMT" \ "Server: /bin/sh" \ "${1-"Location: http://freebase/~loverso/no-ads.gif"}" \ "" } ############################################################################### # # Return an image. Returns either noproxy.clear.gif or noproxy.noads.gif. # # Netscape 4.0 bug with