Class HttpTunnel.HttpTunnelConnection

java.lang.Object
jodd.http.HttpTunnel.HttpTunnelConnection
All Implemented Interfaces:
Runnable
Enclosing class:
HttpTunnel

public class HttpTunnel.HttpTunnelConnection extends Object implements Runnable
Single connection handler that performs the tunneling.
  • Field Details

    • socket

      protected final Socket socket
  • Constructor Details

    • HttpTunnelConnection

      public HttpTunnelConnection(Socket socket)
  • Method Details

    • run

      public void run()
      Specified by:
      run in interface Runnable
    • onRequest

      protected void onRequest(HttpRequest request)
      Invoked after income connection is parsed. Nothing is changed in the request, except the target host and port.
    • onResponse

      protected void onResponse(HttpResponse response)
      Invoked after target response is processed. Response is now ready to be sent back to the client. The following header parameters are changed:
      • Transfer-Encoding is removed, as body is returned at once,
      • Content-Length is added/update to body size.
    • tunnel

      protected void tunnel() throws IOException
      Performs the tunneling. The following steps occurs:
      • read and parse clients request
      • open socket to target
      • resend request to target
      • read targets response
      • fix response and resend it to client
      Throws:
      IOException