Source code for proxy.plugin.man_in_the_middle

# -*- coding: utf-8 -*-
"""
    proxy.py
    ~~~~~~~~
    ⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
    Network monitoring, controls & Application development, testing, debugging.

    :copyright: (c) 2013-present by Abhinav Singh and contributors.
    :license: BSD, see LICENSE for more details.
"""
from typing import Optional

from ..http.proxy import HttpProxyBasePlugin
from ..http.responses import okResponse


[docs]class ManInTheMiddlePlugin(HttpProxyBasePlugin): """Modifies upstream server responses."""
[docs] def handle_upstream_chunk(self, _chunk: memoryview) -> Optional[memoryview]: return okResponse(content=b'Hello from man in the middle')