MCPcopy
hub / github.com/mitmproxy/mitmproxy / make

Method make

mitmproxy/proxy/layers/http/_upstream_proxy.py:32–46  ·  view source on GitHub ↗
(cls, ctx: context.Context, send_connect: bool)

Source from the content-addressed store, hash-verified

30
31 @classmethod
32 def make(cls, ctx: context.Context, send_connect: bool) -> tunnel.LayerStack:
33 assert ctx.server.via
34 scheme, address = ctx.server.via
35 assert scheme in ("http", "https")
36
37 http_proxy = connection.Server(address=address)
38
39 stack = tunnel.LayerStack()
40 if scheme == "https":
41 http_proxy.alpn_offers = tls.HTTP1_ALPNS
42 http_proxy.sni = address[0]
43 stack /= tls.ServerTLSLayer(ctx, http_proxy)
44 stack /= cls(ctx, http_proxy, send_connect)
45
46 return stack
47
48 def start_handshake(self) -> layer.CommandGenerator[None]:
49 if not self.send_connect:

Callers 5

get_connectionMethod · 0.45
make_error_responseFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected