aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/proxy.py
diff options
context:
space:
mode:
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))]