diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-08-18 18:14:30 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-08-18 18:14:30 +1200 |
commit | 53e453f72ede3b99fc36aca998ec78f8c186de1c (patch) | |
tree | 3c8a3c0265da8422711e9a0694bfc92eda23a68f /libmproxy/flow.py | |
parent | 15e234558dc3ca2e7fb3a3ef73211994bf541584 (diff) | |
download | mitmproxy-53e453f72ede3b99fc36aca998ec78f8c186de1c.tar.gz mitmproxy-53e453f72ede3b99fc36aca998ec78f8c186de1c.tar.bz2 mitmproxy-53e453f72ede3b99fc36aca998ec78f8c186de1c.zip |
Use the new ODict get_first convenience function in a bunch of places.
Diffstat (limited to 'libmproxy/flow.py')
-rw-r--r-- | libmproxy/flow.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libmproxy/flow.py b/libmproxy/flow.py index 674197a4..2d016a14 100644 --- a/libmproxy/flow.py +++ b/libmproxy/flow.py @@ -134,9 +134,9 @@ class decoded(object): """ def __init__(self, o): self.o = o - ce = o.headers["content-encoding"] - if ce and ce[0] in encoding.ENCODINGS: - self.ce = ce[0] + ce = o.headers.get_first("content-encoding") + if ce in encoding.ENCODINGS: + self.ce = ce else: self.ce = None @@ -156,11 +156,11 @@ class HTTPMsg(controller.Msg): removes the header. If there is no Content-Encoding header, no action is taken. """ - ce = self.headers["content-encoding"] - if not self.content or not ce or ce[0] not in encoding.ENCODINGS: + ce = self.headers.get_first("content-encoding") + if not self.content or ce not in encoding.ENCODINGS: return self.content = encoding.decode( - ce[0], + ce, self.content ) del self.headers["content-encoding"] |