The HTTPTunnel client listens on configured network ports for incoming client connections. Each new client connection triggers the following sequence of actions. The HTTPTunnel client and server will be referred to as the "httpclient" and "httpserver" - the network client and server will be referred to as the "client" and "server":
- If the port the client connected to, ist the httpclient SOCKS port, a SOCKS handshake will be performed, thereby acquiring the server IP and port number and - if applicable - authenticating the client.
- The httpclient will open a main HTTP connection to the httpserver (using a proxy if applicable) via a HTTP GET request. This connection will stay open as long as the client or server does not close the connection.
- The httpserver will connect to the server and acknowlegde the connection to the httpclient if successful.
- From now on, any incoming data from the server will be forwarded by the httpserver to the httpclient over the main HTTP connection. Before sending the data, it will be compressed, encrypted and base64 encoded. The httpclient will base64 decode, decrypt and uncompress any data coming in from the main HTTP connection and forward it to the client.
- Any incoming data from the client will be forwarded by the httpclient to the httpserver over new, "outbound" HTTP connections. Whenever an outbound HTTP connection is triggered (see also the httpclient advanced configration options), the data will be sent inside a HTTP POST request to the httpserver. Afterwards the connection is closed again. Just like incoming data, outbound data is compressed, encrypted and base64 encoded before being sent. Unlike the main HTTP connection which is established one per tunneled connection, outbound HTTP connections are established whenever needed and can even transmit data packages belonging to different tunneled connections within one request.
After receiving an outbound HTTP request, the httpserver will base64 decode, decrypt and uncompress the POSTed data. Afterwards it will distribute and forward the data to the correct server(s).
- The main HTTP tunnel connection is disconnected if either the server or client closes the network connection.