proxy.http.plugin module#
proxy.py#
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging.
- copyright
2013-present by Abhinav Singh and contributors.
- license
BSD, see LICENSE for more details.
- class proxy.http.plugin.HttpProtocolHandlerPlugin(uid: str, flags: argparse.Namespace, client: proxy.http.connection.HttpClientConnection, request: proxy.http.parser.parser.HttpParser, event_queue: Optional[proxy.core.event.queue.EventQueue] = None, upstream_conn_pool: Optional[UpstreamConnectionPool] = None)[source]#
Bases:
proxy.http.descriptors.DescriptorsHandlerMixin
,abc.ABC
Base HttpProtocolHandler Plugin class.
NOTE: This is an internal plugin and in most cases only useful for core contributors. If you are looking for proxy server plugins see
<proxy.HttpProxyBasePlugin>
.Implements various lifecycle events for an accepted client connection. Following events are of interest:
Client Connection Accepted A new plugin instance is created per accepted client connection. Add your logic within __init__ constructor for any per connection setup.
Client Request Chunk Received on_client_data is called for every chunk of data sent by the client.
Client Request Complete on_request_complete is called once client request has completed.
Server Response Chunk Received on_response_chunk is called for every chunk received from the server.
Client Connection Closed Add your logic within
on_client_connection_close
for any per connection tear-down.
- _abc_impl = <_abc._abc_data object>#
- flags: argparse.Namespace#
- abstract on_client_connection_close() None [source]#
Client connection shutdown has been received, flush has been called, perform any cleanup work here.
- abstract on_client_data(raw: memoryview) None [source]#
Called only after original request has been completely received.
- abstract on_request_complete() Union[socket.socket, bool] [source]#
Called right after client request parser has reached COMPLETE state.
- abstract on_response_chunk(chunk: List[memoryview]) List[memoryview] [source]#
Handle data chunks as received from the server.
Return optionally modified chunk to return back to client.
- request: proxy.http.parser.parser.HttpParser#