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

Method _handle_event

mitmproxy/proxy/layer.py:274–289  ·  view source on GitHub ↗
(self, event: mevents.Event)

Source from the content-addressed store, hash-verified

272 yield from super().handle_event(event)
273
274 def _handle_event(self, event: mevents.Event):
275 self.events.append(event)
276
277 # We receive new data. Let's find out if we can determine the next layer now?
278 if self._ask_on_start and isinstance(event, events.Start):
279 yield from self._ask()
280 elif (
281 isinstance(event, mevents.ConnectionClosed)
282 and event.connection == self.context.client
283 ):
284 # If we have not determined the next protocol yet and the client already closes the connection,
285 # we abort everything.
286 yield commands.CloseConnection(self.context.client)
287 elif isinstance(event, mevents.DataReceived):
288 # For now, we only ask if we have received new data to reduce hook noise.
289 yield from self._ask()
290
291 def _ask(self):
292 """

Callers

nothing calls this directly

Calls 2

_askMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected