I am trying to implement a Socks5 server that could relay both HTTP and HTTPS traffic.
As the RFC1928 mentions, the following steps to establish a connection and forward the data must be taken :
- Client sends a greeting message to the proxy.
- Client & proxy authentication (assuming it is successful).
- Client sends a request to the proxy to connect to the destination.
- The proxy connects to the destination and sends back a response to the client to indicate a successful open tunnel.
- The proxy reads the data from the client and forwards it to the destination.
- The proxy reads the data from the destination and forwards it to the client.
So far, the proxy works as it should. It is able to relay HTTP traffic using its basic data forwarding mechanism. However, any request from the client to an HTTPS website will be aborted because of SSL/TLS encryption.
Is there another sequence/steps that should be followed to be able to handle SSL/TLS (HTTPS) traffic?