diff options
Diffstat (limited to 'examples/stickycookies')
-rwxr-xr-x | examples/stickycookies | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/examples/stickycookies b/examples/stickycookies index 1ae0e113..b290f2fd 100755 --- a/examples/stickycookies +++ b/examples/stickycookies @@ -1,5 +1,12 @@ #!/usr/bin/env python +""" + This example builds on mitmproxy's base proxying infrastructure to + implement functionality similar to the "sticky cookies" option. This is at + a lower level than the Flow mechanism, so we're dealing directly with + request and response objects. +""" from libmproxy import controller, proxy +import os class StickyMaster(controller.Master): def __init__(self, server): @@ -23,12 +30,12 @@ class StickyMaster(controller.Master): def handle_response(self, msg): hid = (msg.request.host, msg.request.port) if msg.headers["set-cookie"]: - self.stickyhosts[hid] = f.response.headers["set-cookie"] + self.stickyhosts[hid] = msg.headers["set-cookie"] msg._ack() ssl_config = proxy.SSLConfig( - "~/.mitmproxy/cert.pem" + cacert = os.path.expanduser("~/.mitmproxy/mitmproxy-ca.pem") ) server = proxy.ProxyServer(ssl_config, 8080) m = StickyMaster(server) |