MCPcopy Create free account
hub / github.com/mitmproxy/mitmproxy / _handle_event

Method _handle_event

mitmproxy/proxy/layers/http/_http2.py:420–432  ·  view source on GitHub ↗
(self, event: Event)

Source from the content-addressed store, hash-verified

418 super().__init__(context, context.client)
419
420 def _handle_event(self, event: Event) -> CommandGenerator[None]:
421 if isinstance(event, ResponseHeaders):
422 if self.is_open_for_us(event.stream_id):
423 self.h2_conn.send_headers(
424 event.stream_id,
425 headers=(
426 yield from format_h2_response_headers(self.context, event)
427 ),
428 end_stream=event.end_stream,
429 )
430 yield SendData(self.conn, self.h2_conn.data_to_send())
431 else:
432 yield from super()._handle_event(event)
433
434 def handle_h2_event(self, event: h2.events.Event) -> CommandGenerator[bool]:
435 if isinstance(event, h2.events.RequestReceived):

Callers 1

_handle_event2Method · 0.45

Calls 4

SendDataClass · 0.85
is_open_for_usMethod · 0.80
send_headersMethod · 0.45

Tested by

no test coverage detected