How to be Virtually Anonymous
By Randal L. Schwartz
Maybe Gisle Aas should work for Nike, because he really keeps on "just doing it." In this case, I'm referring to a neat addition to the already all-singing, all-dancing LWP library (found in the CPAN). Namely, the addition of HTTP::Daemon in version 5.004.
With HTTP::Daemon, it's possible to whip up a "mini HTTP server" in a dozen or so lines of code. And, as I was playing with the new toys for a community-service project I'm working on, it occurred to me that a neat demonstration would be to write a proxy server. Well, more than a proxy server: an anonymizing proxy server!
Anonymous Proxy
The essence of an anonymous proxy is that you tell your browser that all requests should go through that proxy, which strips out all hints that the request came from you in particular, and then handles the actual request. The real Web server being contacted has no clue where the original request came from, although the server can obviously see that it was from your "anon proxy host."
Listing One presents my hastily whipped-up anon proxy server. Lines 1 and 2 begin nearly every program I write. Lines 3 and 4 make life a little easier for a tainted program that I'm debugging.
Lines 6 through 8 are self-explanatory, but I would caution you against using this program as-is.