proxy.http.server.web module#

proxy.py#

⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging.

copyright
  1. 2013-present by Abhinav Singh and contributors.

license

BSD, see LICENSE for more details.

class proxy.http.server.web.HttpWebServerPlugin(*args: Any, **kwargs: Any)[source]#

Bases: proxy.http.plugin.HttpProtocolHandlerPlugin

HttpProtocolHandler plugin which handles incoming requests to local web server.

_abc_impl = <_abc._abc_data object>#
_initialize_web_plugins() None[source]#
property _protocol: Tuple[bool, int]#
_try_route(path: bytes) bool[source]#
_try_static_or_404(path: bytes) None[source]#
access_log(context: Dict[str, Any]) None[source]#
client: HttpClientConnection#
encryption_enabled() bool[source]#
flags: argparse.Namespace#
async get_descriptors() Tuple[List[int], List[int]][source]#

Implementations must return a list of descriptions that they wish to read from and write into.

on_client_connection_close() None[source]#

Client connection shutdown has been received, flush has been called, perform any cleanup work here.

on_client_data(raw: memoryview) None[source]#

Called only after original request has been completely received.

on_request_complete() Union[socket.socket, bool][source]#

Called right after client request parser has reached COMPLETE state.

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.

pipeline_request: Optional[HttpParser]#
plugins: Dict[str, HttpWebServerBasePlugin]#
static protocols() List[int][source]#
async read_from_descriptors(r: List[int]) bool[source]#

Implementations must now read data over the socket.

request: HttpParser#
route: Optional[HttpWebServerBasePlugin]#
routes: Dict[int, Dict[Pattern[str], HttpWebServerBasePlugin]]#
start_time: float#
switch_to_websocket() None[source]#
switched_protocol: Optional[int]#
uid: str#
async write_to_descriptors(w: List[int]) bool[source]#

Implementations must now write/flush data over the socket.

Note that buffer management is in-build into the connection classes. Hence implementations MUST call flush() here, to send any buffered data over the socket.