mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
fe99871df8
If this option is passed all requests that are not part of a replayed conversation are killed. If the option is not passed, such requests are passed through to the server as usual.
32 lines
666 B
Python
32 lines
666 B
Python
import os.path
|
|
from libmproxy import proxy, utils, filt, flow
|
|
|
|
def treq(conn=None):
|
|
if not conn:
|
|
conn = proxy.ClientConnect(("address", 22))
|
|
headers = utils.Headers()
|
|
headers["header"] = ["qvalue"]
|
|
return proxy.Request(conn, "host", 80, "http", "GET", "/path", headers, "content")
|
|
|
|
|
|
def tresp(req=None):
|
|
if not req:
|
|
req = treq()
|
|
headers = utils.Headers()
|
|
headers["header_response"] = ["svalue"]
|
|
return proxy.Response(req, 200, "message", headers, "content_response")
|
|
|
|
|
|
def tflow():
|
|
r = treq()
|
|
return flow.Flow(r)
|
|
|
|
|
|
def tflow_full():
|
|
r = treq()
|
|
f = flow.Flow(r)
|
|
f.response = tresp(r)
|
|
return f
|
|
|
|
|