diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-07-14 15:59:27 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-07-14 16:01:54 +1200 |
commit | 1c9e7b982a7d3fe76f5bd03e53b21b9d450f4607 (patch) | |
tree | d8280341e1f23bce216c934398bf0079d85de444 /libmproxy/flow.py | |
parent | b6e1bf63c3bb49e7515807e6b36dc3116b565f67 (diff) | |
download | mitmproxy-1c9e7b982a7d3fe76f5bd03e53b21b9d450f4607.tar.gz mitmproxy-1c9e7b982a7d3fe76f5bd03e53b21b9d450f4607.tar.bz2 mitmproxy-1c9e7b982a7d3fe76f5bd03e53b21b9d450f4607.zip |
Rewrite Headers object to preserve order and case.
Diffstat (limited to 'libmproxy/flow.py')
-rw-r--r-- | libmproxy/flow.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libmproxy/flow.py b/libmproxy/flow.py index be77af33..d29b8e2d 100644 --- a/libmproxy/flow.py +++ b/libmproxy/flow.py @@ -101,7 +101,7 @@ class ServerPlaybackState: if self.headers: hdrs = [] for i in self.headers: - v = r.headers.get(i, []) + v = r.headers[i] # Slightly subtle: we need to convert everything to strings # to prevent a mismatch between unicode/non-unicode. v = [str(x) for x in v] @@ -139,7 +139,7 @@ class StickyCookieState: ) def handle_response(self, f): - for i in f.response.headers.get("set-cookie", []): + for i in f.response.headers["set-cookie"]: # FIXME: We now know that Cookie.py screws up some cookies with # valid RFC 822/1123 datetime specifications for expiry. Sigh. c = Cookie.SimpleCookie(i) @@ -158,9 +158,10 @@ class StickyCookieState: f.request.path.startswith(i[2]) ] if all(match): - l = f.request.headers.setdefault("cookie", []) + l = f.request.headers["cookie"] f.request.stickycookie = True l.append(self.jar[i].output(header="").strip()) + f.request.headers["cookie"] = l class StickyAuthState: |