[Eug-lug] Blocking ad servers via host redirection, apache, and you.

Bob Miller kbob at jogger-egg.com
Thu Oct 11 16:21:59 PDT 2007


Alan wrote:

> Yeah, I don't really want to use client side processing though. The
> machines are slow enough as they are. heh.

Client-side fetching, storing, and rendering of the big grey GIF aren't
free either, and if you're running apache on localhost...

Here's a simple Python web server that serves the same GIF file for
every request.  Create your own empty GIF file and call it 'null.gif'
in the current directory.  Then run this as root.  It'll take over
port 80.

    #!/usr/bin/python

    import BaseHTTPServer

    class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
	def do_GET(self):
	    self.send_response(200, 'OK')
	    self.send_header('Content-Type', 'image/gif')
	    self.wfile.write(open('null.gif').read())

    if __name__ == '__main__':
	BaseHTTPServer.HTTPServer(('localhost', 80), MyHandler).serve_forever()

But AdBlock is a better solution.

-- 
Bob Miller                              K<bob>
                                        kbob at jogger-egg.com


More information about the EUGLUG mailing list