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

Method redirect_response

mitmproxy/platform/windows.py:520–534  ·  view source on GitHub ↗

If the proxy responds to the client, let the client believe the target server sent the packets.

(self, packet: pydivert.Packet)

Source from the content-addressed store, hash-verified

518 self.response.windivert.send(packet)
519
520 def redirect_response(self, packet: pydivert.Packet):
521 """
522 If the proxy responds to the client, let the client believe the target server sent the
523 packets.
524 """
525 # print(" * Adjust proxy -> client")
526 client = (packet.dst_addr, packet.dst_port)
527 try:
528 packet.src_addr, packet.src_port = self.client_server_map[client]
529 except KeyError:
530 print(f"Warning: Previously unseen connection from proxy to {client}")
531 else:
532 packet.recalculate_checksums()
533
534 self.response.windivert.send(packet, recalculate_checksum=False)
535
536 @contextlib.contextmanager
537 def exempt(self, pid: int):

Callers

nothing calls this directly

Calls 1

sendMethod · 0.45

Tested by

no test coverage detected