There are lots of web proxies out there. Web proxies for just about every purpose imaginable. But there was one kind of proxy which didn't exist, which I badly wanted for my work: one that showed you the entire HTTP conversation and, optionally, let you modify it en route! (And not some crappy excuse for a proxy that makes you run a separate copy for each page you want to load! *coughnetgravitycough*) Since it didn't exist, I had to scratch my personal itch and create it.
Note as of 03Mar2004: I see that someone has written Charles , and it looks pretty nice, although it's also graphical and written in Java (ick) so I think there's still a place in the world for visproxy.

After a very long time of thinking about it, and a couple abortive starts, I've finally got something that works. It's funny how sometimes you can work on something for a long time and fail, and try and try again and never succeed, and then suddenly sit down and bang out the whole thing in two days. Maybe you just have to be in the right mindset. (BTW, this project used to be called hackproxy; I decided I didn't like that name.)

This is a very crude, dead simple proxy. It uses a forking model so each connection is handled by a separate process, and it prints out the entire request and the headers of the response (it could print out the entire response, but you probably don't want a GIF on your terminal...) It passes on the original request and the response almost unchanged (I do drop Keep-Alives); this is arguably wrong, but I prefer to think of it as Bad and Right. It listens on port 8000; if you want something different, you just have to edit the source for now. Just run it, set your browser's proxy settings, and go. Output looks like this:

--> www.panix.com: GET http://www.panix.com/~jdw/bubble/ HTTP/1.0
--> www.panix.com: Referer: http://www.panix.com/~jdw/
--> www.panix.com: Proxy-Connection: Keep-Alive
--> www.panix.com: User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.5 i686)
--> www.panix.com: Pragma: no-cache
--> www.panix.com: Host: www.panix.com
--> www.panix.com: Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*
--> www.panix.com: Accept-Encoding: gzip
--> www.panix.com: Accept-Language: en
--> www.panix.com: Accept-Charset: iso-8859-1,*,utf-8
--> www.panix.com:

        new webserver connection IO::Socket::INET=GLOB(0x820225c)
        <-- www.panix.com: HTTP/1.0 200 OK
        <-- www.panix.com: Date: Tue, 02 Apr 2002 17:25:44 GMT
        <-- www.panix.com: Server: Apache/1.3.12 (Unix) PHP/4.0.6 mod_perl/1.24 mod_ssl/2.6.6 OpenSSL/0.9.6
        <-- www.panix.com: Content-Type: text/html
        <-- www.panix.com: X-Cache: MISS from squid1.nyc.access.net
        <-- www.panix.com: Proxy-Connection: close
        (www.panix.com: data follows)

        www.panix.com closed connection IO::Socket::INET=GLOB(0x820225c).

I want to stress that this is not a general-purpose proxy. It seems amazingly bug-free, given my hackish coding, but it is neither fast nor complete and certainly isn't guaranteed to work. Nonetheless, you may find it educational - I certainly didn't realize how chatty some web browsers (or how weird some web servers) were until I ran them through this proxy.

Oh, and one more thing...this proxy appears not to work very well with www.microsoft.com. I may not fix it. Ha ha ha ha ha ha. More seriously, it tends to choke on any page with a lot of images - although it works remarkably well with www.thinkgeek.com.

D'OH! It doesn't do POSTs. I should fix this.
D'OH! D'OH! It doesn't do HTTPS. I probably won't fix this.
D'OH!^3 It sometimes does something funny with images unrelated to the problem I mentioned before. Not sure about this one.

Download here...
visproxy.pl, v0.2, 02 April 2002
visproxy.pl, v0.1, 04 April 2002