MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / _setup_explicit_http_proxy

Method _setup_explicit_http_proxy

mitmproxy/addons/next_layer.py:407–420  ·  view source on GitHub ↗
(context: Context, data_client: bytes)

Source from the content-addressed store, hash-verified

405
406 @staticmethod
407 def _setup_explicit_http_proxy(context: Context, data_client: bytes) -> Layer:
408 stack = tunnel.LayerStack()
409
410 if context.client.transport_protocol == "udp":
411 stack /= layers.ClientQuicLayer(context)
412 elif starts_like_tls_record(data_client):
413 stack /= layers.ClientTLSLayer(context)
414
415 if isinstance(context.layers[0], modes.HttpUpstreamProxy):
416 stack /= layers.HttpLayer(context, HTTPMode.upstream)
417 else:
418 stack /= layers.HttpLayer(context, HTTPMode.regular)
419
420 return stack[0]
421
422 @staticmethod
423 def _is_destination_in_hosts(context: Context, hosts: Iterable[re.Pattern]) -> bool:

Callers 1

_next_layerMethod · 0.95

Calls 1

starts_like_tls_recordFunction · 0.90

Tested by

no test coverage detected