diff options
author | Maximilian Hils <git@maximilianhils.com> | 2014-05-15 14:37:05 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2014-05-15 14:37:05 +0200 |
commit | a17a53269d23d0bde74c340c9df4b1983b70144b (patch) | |
tree | 205301aa271cea8af029b608c1b830289bb67718 /examples | |
parent | 9cba4f8d397d212f60ffc52f02dabf97b126e540 (diff) | |
download | mitmproxy-a17a53269d23d0bde74c340c9df4b1983b70144b.tar.gz mitmproxy-a17a53269d23d0bde74c340c9df4b1983b70144b.tar.bz2 mitmproxy-a17a53269d23d0bde74c340c9df4b1983b70144b.zip |
fix #253
Diffstat (limited to 'examples')
-rw-r--r-- | examples/read_dumpfile (renamed from examples/read_dumpfile.py) | 0 | ||||
-rw-r--r-- | examples/redirect_requests.py | 13 |
2 files changed, 6 insertions, 7 deletions
diff --git a/examples/read_dumpfile.py b/examples/read_dumpfile index 547f3c17..547f3c17 100644 --- a/examples/read_dumpfile.py +++ b/examples/read_dumpfile diff --git a/examples/redirect_requests.py b/examples/redirect_requests.py index 3a3ad300..278160c7 100644 --- a/examples/redirect_requests.py +++ b/examples/redirect_requests.py @@ -1,18 +1,17 @@ -from libmproxy.flow import Response +from libmproxy.protocol.http import HTTPResponse from netlib.odict import ODictCaseless """ This example shows two ways to redirect flows to other destinations. """ + def request(context, flow): if flow.request.host.endswith("example.com"): - resp = Response(flow.request, - [1,1], - 200, "OK", - ODictCaseless([["Content-Type","text/html"]]), - "helloworld", - None) + resp = HTTPResponse( + [1, 1], 200, "OK", + ODictCaseless([["Content-Type", "text/html"]]), + "helloworld") flow.request.reply(resp) if flow.request.host.endswith("example.org"): flow.request.host = "mitmproxy.org" |