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

Method request

mitmproxy/addons/blocklist.py:69–81  ·  view source on GitHub ↗
(self, flow: http.HTTPFlow)

Source from the content-addressed store, hash-verified

67 self.items.append(spec)
68
69 def request(self, flow: http.HTTPFlow) -> None:
70 if flow.response or flow.error or not flow.live:
71 return
72
73 for spec in self.items:
74 if spec.matches(flow):
75 flow.metadata["blocklisted"] = True
76 if spec.status_code == NO_RESPONSE:
77 flow.kill()
78 else:
79 flow.response = http.Response.make(
80 spec.status_code, headers={"Server": version.MITMPROXY}
81 )

Calls 2

killMethod · 0.45
makeMethod · 0.45