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

Method handle_hook

mitmproxy/addons/clientplayback.py:127–142  ·  view source on GitHub ↗
(self, hook: commands.StartHook)

Source from the content-addressed store, hash-verified

125 logger.log(level=level, msg=f"[replay] {message}")
126
127 async def handle_hook(self, hook: commands.StartHook) -> None:
128 (data,) = hook.args()
129 await ctx.master.addons.handle_lifecycle(hook)
130 if isinstance(data, flow.Flow):
131 await data.wait_for_resume()
132 if isinstance(hook, (layers.http.HttpResponseHook, layers.http.HttpErrorHook)):
133 if self.transports:
134 # close server connections
135 for x in self.transports.values():
136 if x.handler:
137 x.handler.cancel()
138 await asyncio.wait(
139 [x.handler for x in self.transports.values() if x.handler]
140 )
141 # signal completion
142 self.done.set()
143
144
145class ClientPlayback:

Callers

nothing calls this directly

Calls 6

argsMethod · 0.80
handle_lifecycleMethod · 0.80
wait_for_resumeMethod · 0.80
valuesMethod · 0.80
waitMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected