diff options
author | Rouli <rouli.net@gmail.com> | 2013-03-18 14:24:13 +0200 |
---|---|---|
committer | Rouli <rouli.net@gmail.com> | 2013-03-18 14:24:13 +0200 |
commit | c94aadcb0ee5e7aab8acc46a0e4ac7d02a28df6f (patch) | |
tree | 1e62785d669d86f6e551a99b9debfe445389bd48 /examples | |
parent | b6cae7cd2d0105d6a6fe9d35864d0f9b7c5f8924 (diff) | |
parent | 5c33f6784b4ba34dd9825ea7e3070cdf0b2b4621 (diff) | |
download | mitmproxy-c94aadcb0ee5e7aab8acc46a0e4ac7d02a28df6f.tar.gz mitmproxy-c94aadcb0ee5e7aab8acc46a0e4ac7d02a28df6f.tar.bz2 mitmproxy-c94aadcb0ee5e7aab8acc46a0e4ac7d02a28df6f.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'examples')
-rw-r--r-- | examples/README | 1 | ||||
-rwxr-xr-x | examples/flowbasic | 8 | ||||
-rwxr-xr-x | examples/iframe_injector | 4 | ||||
-rwxr-xr-x | examples/proxapp | 4 | ||||
-rwxr-xr-x | examples/stickycookies | 4 |
5 files changed, 11 insertions, 10 deletions
diff --git a/examples/README b/examples/README index ab06ad27..0a4684a7 100644 --- a/examples/README +++ b/examples/README @@ -3,6 +3,7 @@ dup_and_replay.py Duplicates each request, changes it, and then replays th flowbasic Basic use of mitmproxy as a library. modify_form.py Modify all form submissions to add a parameter. modify_querystring.py Modify all query strings to add a parameters. +proxapp How to embed a WSGI app in a mitmproxy server stub.py Script stub with a method definition for every event. stickycookies An example of writing a custom proxy with libmproxy. upsidedownternet.py Rewrites traffic to turn PNGs upside down. diff --git a/examples/flowbasic b/examples/flowbasic index b419f9e7..b8184262 100755 --- a/examples/flowbasic +++ b/examples/flowbasic @@ -3,8 +3,8 @@ This example shows how to build a proxy based on mitmproxy's Flow primitives. - Note that request and response messages are not automatically acked, so we - need to implement handlers to do this. + Note that request and response messages are not automatically replied to, + so we need to implement handlers to do this. """ import os from libmproxy import proxy, flow @@ -19,13 +19,13 @@ class MyMaster(flow.FlowMaster): def handle_request(self, r): f = flow.FlowMaster.handle_request(self, r) if f: - r._ack() + r.reply() return f def handle_response(self, r): f = flow.FlowMaster.handle_response(self, r) if f: - r._ack() + r.reply() print f return f diff --git a/examples/iframe_injector b/examples/iframe_injector index 6dd28674..8b1e02f1 100755 --- a/examples/iframe_injector +++ b/examples/iframe_injector @@ -23,14 +23,14 @@ class InjectingMaster(controller.Master): def handle_request(self, msg): if 'Accept-Encoding' in msg.headers: msg.headers["Accept-Encoding"] = 'none' - msg._ack() + msg.reply() def handle_response(self, msg): if msg.content: c = msg.replace('<body>', '<body><iframe src="%s" frameborder="0" height="0" width="0"></iframe>' % self._iframe_url) if c > 0: print 'Iframe injected!' - msg._ack() + msg.reply() def main(argv): diff --git a/examples/proxapp b/examples/proxapp index e8179528..eb5bdbb7 100755 --- a/examples/proxapp +++ b/examples/proxapp @@ -23,13 +23,13 @@ class MyMaster(flow.FlowMaster): def handle_request(self, r): f = flow.FlowMaster.handle_request(self, r) if f: - r._ack() + r.reply() return f def handle_response(self, r): f = flow.FlowMaster.handle_response(self, r) if f: - r._ack() + r.reply() print f return f diff --git a/examples/stickycookies b/examples/stickycookies index 88bf0063..b07820fc 100755 --- a/examples/stickycookies +++ b/examples/stickycookies @@ -25,13 +25,13 @@ class StickyMaster(controller.Master): self.stickyhosts[hid] = msg.headers["cookie"] elif hid in self.stickyhosts: msg.headers["cookie"] = self.stickyhosts[hid] - msg._ack() + msg.reply() def handle_response(self, msg): hid = (msg.request.host, msg.request.port) if msg.headers["set-cookie"]: self.stickyhosts[hid] = msg.headers["set-cookie"] - msg._ack() + msg.reply() config = proxy.ProxyConfig( |