I'm playing around with Ratpack as a very basic authenticating HTTP proxy. Based on previous help, I got something working for HTTP. But HTTPS is a whole different kettle of fish.
The idea is that the HTTP client sends a plain HTTP CONNECT request, which the proxy server should use to set up a plain TCP connection to the target server. I've looked through the Ratpack API docs but it seems to be focused on HTTP. So I'm assuming that I need to use native Netty to open a TCP client connection. In that case, does anyone have an idea of how to open the client connection and stream data from the initial HTTP request to the TCP tunnel, and stream the data from the TCP tunnel to the HTTP response?
The HttpClient class seems to have nice `requestStream()` and `forwardTo()` methods, so I guess I may have a look at the source code for those. I don't really want to go too far down the rabbit hole for this though.
One thing that may be worth looking into is a set of client classes that make it easier to integrate between Ratpack and raw Netty. DefaultHttpClient does this, but the code is not for the faint of heart.
I didn't see this before posting the previous reply. It certainly looks a lot less code than I have! I added a comment direct to the gist about the CONNECT response. That may help. Thanks for your responses btw.