2011-01-30 22:48:53 +00:00
|
|
|
from libmproxy import proxy, utils, filt, flow
|
|
|
|
|
|
|
|
def treq(conn=None):
|
|
|
|
if not conn:
|
2011-02-03 21:05:07 +00:00
|
|
|
conn = proxy.ClientConnection(("address", 22))
|
2011-01-30 22:48:53 +00:00
|
|
|
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"]
|
2011-02-15 17:44:57 +00:00
|
|
|
return proxy.Response(req, 200, "message", headers, "content_response")
|
2011-01-30 22:48:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
def tflow():
|
2011-02-03 21:05:07 +00:00
|
|
|
bc = proxy.ClientConnection(("address", 22))
|
2011-01-30 22:48:53 +00:00
|
|
|
return flow.Flow(bc)
|
|
|
|
|