Package org.microproxy.frames
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 TypeMethodDescriptionThe client's address, or null when the frame belongs to no single client.longThe 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 anHttp3FramePipelineruns.protocol()The frame's protocol.voidAdds 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.server()The server'shost:portfor frames to and from a server, null on the client side.longstreamId()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_2orFrameProtocol.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'shost:portfor 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 anHttp3FramePipelineruns. 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
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 inFrameInterceptor; 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 returnedNullPointerException- ifframeis null
-