aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/proxy.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2011-08-02 16:52:47 +1200
committerAldo Cortesi <aldo@nullcube.com>2011-08-02 16:52:47 +1200
commit1ff6a767d001a8c0f45a190e26be363ea9410534 (patch)
treeca511b918637e306140be6318dab05037ed4beda /libmproxy/proxy.py
parent357502fe03a5f86c1c29d35c5d607541df157640 (diff)
downloadmitmproxy-1ff6a767d001a8c0f45a190e26be363ea9410534.tar.gz
mitmproxy-1ff6a767d001a8c0f45a190e26be363ea9410534.tar.bz2
mitmproxy-1ff6a767d001a8c0f45a190e26be363ea9410534.zip
Unit test++
Diffstat (limited to 'libmproxy/proxy.py')
-rw-r--r--libmproxy/proxy.py23
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))]