Struct http_mitm_proxy::Communication
source · pub struct Communication<B> {
pub client_addr: SocketAddr,
pub request: Request<Incoming>,
pub request_back: Sender<Request<B>>,
pub response: Receiver<Result<Response<UnboundedReceiver<Result<Frame<Bytes>, Arc<Error>>>>, Error>>,
pub upgrade: Receiver<Upgrade>,
}Expand description
Communication between client and server.
Note: http-mitm-proxy observe by Communication basis, not Connection basis. Some Communications may belong to the same connection using keep-alive.
Fields§
§client_addr: SocketAddrClient address
request: Request<Incoming>Request from client. request.uri() is an absolute URI except for CONNECT method.
If you modify uri of CONNECT method, subsequent request will be sent to the modified uri (off course you can modify it). But HOST header remains the original value.
request_back: Sender<Request<B>>Send request back to server. You can modify request before sending it back. NOTE: If you drop this without send(), communication will be canceled and server will not receive request and client will get 500 Internal Server Error.
response: Receiver<Result<Response<UnboundedReceiver<Result<Frame<Bytes>, Arc<Error>>>>, Error>>Response from server. Be sent error if fails to get response from server.
upgrade: Receiver<Upgrade>Upgraded connection. Proxy will upgrade connection if and only if response status is 101.