Interface FrameContext


public interface FrameContext
Where an intercepted frame travels, and a way to add frames next to it. A context is valid only during the FrameInterceptor.intercept(org.microproxy.frames.HttpFrame, org.microproxy.frames.FrameDirection, org.microproxy.frames.FrameContext) call it is given to.
  • Method Summary

    Modifier and Type
    Method
    Description
    The client's address, or null when the frame belongs to no single client.
    long
    The client connection the frame belongs to (FlowContext.getConnectionId()), or -1 for a frame of a connection to a server that serves several clients (one not about a stream) or a pipeline given no id.
    The exchange the frame belongs to, or null for connection frames and for frames that come before their exchange exists: the HEADERS that open an HTTP/2 stream from a client, and frames an Http3FramePipeline runs.
    The frame's protocol.
    void
    send(HttpFrame frame)
    Adds a frame after the one being intercepted, on the same hop and in the same direction: going out, it is sent after the intercepted frame (or what replaced it); coming in, the proxy processes it as if the peer had sent it next.
    The server's host:port for frames to and from a server, null on the client side.
    long
    The stream the frame belongs to: for HTTP/2 the frame's stream id, 0 for the connection; for HTTP/3 the QUIC stream's id, or -1 when the pipeline was given none.
  • Method Details

    • protocol

      FrameProtocol protocol()
      The frame's protocol.
      Returns:
      FrameProtocol.HTTP_2 or FrameProtocol.HTTP_3
    • connectionId

      long connectionId()
      The client connection the frame belongs to (FlowContext.getConnectionId()), or -1 for a frame of a connection to a server that serves several clients (one not about a stream) or a pipeline given no id.
      Returns:
      the client connection's id, or -1
    • clientAddress

      InetSocketAddress clientAddress()
      The client's address, or null when the frame belongs to no single client.
      Returns:
      the client address, or null
    • server

      String server()
      The server's host:port for frames to and from a server, null on the client side.
      Returns:
      the server, or null
    • streamId

      long streamId()
      The stream the frame belongs to: for HTTP/2 the frame's stream id, 0 for the connection; for HTTP/3 the QUIC stream's id, or -1 when the pipeline was given none.
      Returns:
      the stream id
    • flowContext

      FlowContext flowContext()
      The exchange the frame belongs to, or null for connection frames and for frames that come before their exchange exists: the HEADERS that open an HTTP/2 stream from a client, and frames an Http3FramePipeline runs. A live HTTP/3 request stream has its exchange's context from its first frame on.
      Returns:
      the exchange's flow context, or null
    • send

      void send(HttpFrame frame)
      Adds a frame after the one being intercepted, on the same hop and in the same direction: going out, it is sent after the intercepted frame (or what replaced it); coming in, the proxy processes it as if the peer had sent it next. Frames are added in the order of the calls. What may be added is described in FrameInterceptor; a result that breaks those rules is discarded together with the interceptor's return value.
      Parameters:
      frame - the frame to add
      Throws:
      IllegalStateException - if the interceptor call this context was given to has returned
      NullPointerException - if frame is null