Class FullFlowContext

java.lang.Object
org.microproxy.FlowContext
org.microproxy.FullFlowContext

public class FullFlowContext extends FlowContext
A FlowContext that also knows the server side of the flow.
  • Constructor Details

    • FullFlowContext

      public FullFlowContext(FlowContext clientContext, String serverHostAndPort, ChainedProxy chainedProxy, InetSocketAddress remoteAddress)
      Creates a server-side view of a client exchange.
      Parameters:
      clientContext - the client connection or exchange context
      serverHostAndPort - the requested server host and port
      chainedProxy - the upstream proxy in use, or null for direct routing
      remoteAddress - the connected server or upstream proxy address
    • FullFlowContext

      public FullFlowContext(FlowContext clientContext, String serverHostAndPort, ChainedProxy chainedProxy, InetSocketAddress remoteAddress, Supplier<SSLSession> serverSslSession)
      Creates a server-side view of a client exchange that knows the TLS session with the server.
      Parameters:
      clientContext - the client connection or exchange context
      serverHostAndPort - the requested server host and port
      chainedProxy - the upstream proxy in use, or null for direct routing
      remoteAddress - the connected server or upstream proxy address
      serverSslSession - the supplier of the TLS session with the server, which may return null; asked each time, so it follows the connection in use
  • Method Details

    • getClientContext

      public FlowContext getClientContext()
      Returns the client-side context this server-side view was made from.
      Returns:
      the client-side context this server-side view was made from
    • getServerHostAndPort

      public String getServerHostAndPort()
      Returns the host:port the client asked for.
      Returns:
      the host:port the client asked for
    • getChainedProxy

      public ChainedProxy getChainedProxy()
      Returns the upstream proxy in use, or null for a direct connection.
      Returns:
      the upstream proxy in use, or null for a direct connection
    • getRemoteAddress

      public InetSocketAddress getRemoteAddress()
      Returns the address the proxy is connected to: the server, or the chained proxy.
      Returns:
      the address the proxy is connected to: the server, or the chained proxy
    • getServerSslSession

      public SSLSession getServerSslSession()
      The TLS session with the server this flow's requests go to, end to end: with the origin server, whether the proxy intercepts the client's TLS or opens its own TLS connection to the server, and through a TLS chained proxy the session with the server inside the tunnel, not the one with the chained proxy. It is the session of the connection the requests are sent on (a reused pooled connection's, or the one a retry without SNI made), and an HTTP/2 stream's is its connection's. It is already established in ActivityTracker.requestSentToServer(org.microproxy.FullFlowContext, org.microproxy.http.HttpRequest).

      HTTP/3 (QUIC) flows have no SSLSession: this is null for them.

      Returns:
      the TLS session with the server this flow's requests go to, or null when the connection to it is not TLS (plain HTTP, a tunnel the proxy does not intercept) or its handshake has not completed