diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-08-02 16:52:47 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-08-02 16:52:47 +1200 |
commit | 1ff6a767d001a8c0f45a190e26be363ea9410534 (patch) | |
tree | ca511b918637e306140be6318dab05037ed4beda /libmproxy/proxy.py | |
parent | 357502fe03a5f86c1c29d35c5d607541df157640 (diff) | |
download | mitmproxy-1ff6a767d001a8c0f45a190e26be363ea9410534.tar.gz mitmproxy-1ff6a767d001a8c0f45a190e26be363ea9410534.tar.bz2 mitmproxy-1ff6a767d001a8c0f45a190e26be363ea9410534.zip |
Unit test++
Diffstat (limited to 'libmproxy/proxy.py')
-rw-r--r-- | libmproxy/proxy.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 3ecd1f32..0c142959 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -284,11 +284,16 @@ class Request(HTTPMsg): modifications to make sure interception works properly. """ headers = self.headers.copy() - utils.try_del(headers, 'proxy-connection') - utils.try_del(headers, 'keep-alive') - utils.try_del(headers, 'connection') - utils.try_del(headers, 'content-length') - utils.try_del(headers, 'transfer-encoding') + utils.del_all( + headers, + [ + 'proxy-connection', + 'keep-alive', + 'connection', + 'content-length', + 'transfer-encoding' + ] + ) if not 'host' in headers: headers["host"] = [self.hostport()] content = self.content @@ -426,10 +431,10 @@ class Response(HTTPMsg): modifications to make sure interception works properly. """ headers = self.headers.copy() - utils.try_del(headers, 'proxy-connection') - utils.try_del(headers, 'connection') - utils.try_del(headers, 'keep-alive') - utils.try_del(headers, 'transfer-encoding') + utils.del_all( + headers, + ['proxy-connection', 'connection', 'keep-alive', 'transfer-encoding'] + ) content = self.content if content is not None: headers["content-length"] = [str(len(content))] |