Basically I’m trying to write a proxy for http requests. I’ve been able to set up the server fairly easily, and after directing my browser to the proxy instead of the direct connection, it is receiving the raw http requests sent from the browser.
My problem now is that I need to be able to now send the raw request from the proxy to retrieve the response from the destination server. I’ve been trying to dig around through Apache’s HttpClient, but as far as I can see, I’m still unsure how it can be used to facilitate in sending raw requests.
Any suggestions?
You don’t need any HTTP-aware code in yur proxy at all beyond recognizing the CONNECT command. The rest of it is just copying bytes backwards and forwards. You can use two threads for this (per connection), or you can do it all in one thread with NIO.