MCPcopy
hub / github.com/mitmproxy/mitmproxy / kill

Method kill

mitmproxy/flow.py:230–242  ·  view source on GitHub ↗

Kill this flow. The current request/response will not be forwarded to its destination.

(self)

Source from the content-addressed store, hash-verified

228 return self.live and not (self.error and self.error.msg == Error.KILLED_MESSAGE)
229
230 def kill(self):
231 """
232 Kill this flow. The current request/response will not be forwarded to its destination.
233 """
234 if not self.killable:
235 raise exceptions.ControlException("Flow is not killable.")
236 # TODO: The way we currently signal killing is not ideal. One major problem is that we cannot kill
237 # flows in transit (https://github.com/mitmproxy/mitmproxy/issues/4711), even though they are advertised
238 # as killable. An alternative approach would be to introduce a `KillInjected` event similar to
239 # `MessageInjected`, which should fix this issue.
240 self.error = Error(Error.KILLED_MESSAGE)
241 self.intercepted = False
242 self.live = False
243
244 def intercept(self):
245 """

Callers 13

test_killMethod · 0.45
killFunction · 0.45
test_already_handledMethod · 0.45
test_takenMethod · 0.45
test_is_killedMethod · 0.45
test_takenMethod · 0.45
test_is_killedMethod · 0.45
procsMethod · 0.45
requestFunction · 0.45
errorFunction · 0.45
onKeyDownFunction · 0.45

Calls 1

ErrorClass · 0.70

Tested by 8

test_killMethod · 0.36
killFunction · 0.36
test_already_handledMethod · 0.36
test_takenMethod · 0.36
test_is_killedMethod · 0.36
test_takenMethod · 0.36
test_is_killedMethod · 0.36