aboutsummaryrefslogtreecommitdiffstats
path: root/examples/stickycookies
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-09-06 01:37:19 +0200
committerMaximilian Hils <git@maximilianhils.com>2015-09-06 01:37:19 +0200
commiteb2334c6cb7c9ab9c260bc609ae43fb53d441f6f (patch)
treea6b263b856bd035ac154b45fe7e91706918b25f3 /examples/stickycookies
parent853cd810757a02252402da22ae77cab77c5a3fb6 (diff)
parenta8d931089c9ecf450b69321706825cf694c1c08e (diff)
downloadmitmproxy-eb2334c6cb7c9ab9c260bc609ae43fb53d441f6f.tar.gz
mitmproxy-eb2334c6cb7c9ab9c260bc609ae43fb53d441f6f.tar.bz2
mitmproxy-eb2334c6cb7c9ab9c260bc609ae43fb53d441f6f.zip
Merge branch 'master' into readthedocs
Diffstat (limited to 'examples/stickycookies')
-rwxr-xr-xexamples/stickycookies10
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/stickycookies b/examples/stickycookies
index 67b31da1..7e84f71c 100755
--- a/examples/stickycookies
+++ b/examples/stickycookies
@@ -23,16 +23,16 @@ class StickyMaster(controller.Master):
def handle_request(self, flow):
hid = (flow.request.host, flow.request.port)
- if flow.request.headers["cookie"]:
- self.stickyhosts[hid] = flow.request.headers["cookie"]
+ if "cookie" in flow.request.headers:
+ self.stickyhosts[hid] = flow.request.headers.get_all("cookie")
elif hid in self.stickyhosts:
- flow.request.headers["cookie"] = self.stickyhosts[hid]
+ flow.request.headers.set_all("cookie", self.stickyhosts[hid])
flow.reply()
def handle_response(self, flow):
hid = (flow.request.host, flow.request.port)
- if flow.response.headers["set-cookie"]:
- self.stickyhosts[hid] = flow.response.headers["set-cookie"]
+ if "set-cookie" in flow.response.headers:
+ self.stickyhosts[hid] = flow.response.headers.get_all("set-cookie")
flow.reply()