Rocking the blogosphere
Apple Online Store

Using an HTTP proxy (shown via netcat)

Ever wonder how applications talk to HTTP proxies? It’s simple really (like the rest of HTTP) - there’s a simple HTTP request method called CONNECT. It’s easily illustrated with a quick session of netcat:

$ nc -v proxy.foobar.com 3128
proxy.foobar.com [10.xx.xx.xxx] 3128 (?) open : Operation now in progress
CONNECT marc-abramowitz.com:80 HTTP/1.0

HTTP/1.0 200 Connection established

GET / HTTP/1.1
Host: marc-abramowitz.com

HTTP/1.1 200 OK
Date: Fri, 21 Sep 2007 00:02:34 GMT
.........

Nothing magical.

The above process can be done with a program, of course. The one I am most familiar with is called corkscrew. With it you can do things like:

$ corkscrew proxy.foobar.com 3128 marc-abramowitz.com 80
GET / HTTP/1.1
Host: marc-abramowitz.com

HTTP/1.1 200 OK
Date: Wed, 28 Nov 2007 19:03:29 GMT
...

The corkscrew program is very useful in particular with the ProxyCommand config directive in OpenSSH as discussed in my post on using SSH though an HTTP proxy.

Del.icio.us Digg Reddit Technorati

Possibly related posts

No comments yet. Be the first.

Leave a reply

Apple Online Store
Apple Online Store