2. Working with Proxies

A final step, once you get that stuff working, is to implement support for HTTP proxies. This is very easy. Give the user a checkbox if they want to use a proxy or not, and if so, ask the proxy host and proxy port. Now, if they selected to use a proxy, do not connect to www.livejournal.com and port 80, but instead connect to their proxy host on whatever proxy port they specified. The rest is basically the same, except for one difference. Instead of doing:

POST /interface/flat HTTP/1.1 

You would do:

POST http://www.livejournal.com/interface/flat HTTP/1.1 

That line tells the proxy what host it needs to connect to in order to make the real request. The rest of the HTTP you should leave just as you did before.