2011-02-20 20:54:39 +00:00
|
|
|
import os.path
|
2011-01-30 22:48:53 +00:00
|
|
|
from libmproxy import proxy, utils, filt, flow
|
|
|
|
|
|
|
|
def treq(conn=None):
|
|
|
|
if not conn:
|
2011-02-19 04:00:24 +00:00
|
|
|
conn = proxy.ClientConnect(("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-19 04:00:24 +00:00
|
|
|
r = treq()
|
|
|
|
return flow.Flow(r)
|
2011-01-30 22:48:53 +00:00
|
|
|
|
2011-02-20 20:54:39 +00:00
|
|
|
|
2011-02-20 22:08:35 +00:00
|
|
|
def tflow_full():
|
|
|
|
r = treq()
|
|
|
|
f = flow.Flow(r)
|
|
|
|
f.response = tresp(r)
|
|
|
|
return f
|
|
|
|
|
|
|
|
|