aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/proxy.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2011-07-15 15:21:04 +1200
committerAldo Cortesi <aldo@nullcube.com>2011-07-15 15:24:56 +1200
commit76b4c6ba82f9a1d6411710c82c67cf264d3bb1d3 (patch)
treea17515f8f829136cfd0da5187b2139dede4c43c5 /libmproxy/proxy.py
parent1a963b91bb61db8fa2bf5df82768a39e97a6cc90 (diff)
downloadmitmproxy-76b4c6ba82f9a1d6411710c82c67cf264d3bb1d3.tar.gz
mitmproxy-76b4c6ba82f9a1d6411710c82c67cf264d3bb1d3.tar.bz2
mitmproxy-76b4c6ba82f9a1d6411710c82c67cf264d3bb1d3.zip
Introduce an anti-compression command-line argument.
This is on by default, which means we avoid compressed content unless the -z flag is specified.
Diffstat (limited to 'libmproxy/proxy.py')
-rw-r--r--libmproxy/proxy.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py
index 690df9f4..fe545335 100644
--- a/libmproxy/proxy.py
+++ b/libmproxy/proxy.py
@@ -154,6 +154,13 @@ class Request(controller.Msg):
for i in delheaders:
del self.headers[i]
+ def anticomp(self):
+ """
+ Modifies this request to remove headers that might produce a cached
+ response. That is, we remove ETags and If-Modified-Since headers.
+ """
+ self.headers["accept-encoding"] = ["identity"]
+
def set_replay(self):
self.client_conn = None
@@ -244,7 +251,6 @@ class Request(controller.Msg):
modifications to make sure interception works properly.
"""
headers = self.headers.copy()
- utils.try_del(headers, 'accept-encoding')
utils.try_del(headers, 'proxy-connection')
utils.try_del(headers, 'keep-alive')
utils.try_del(headers, 'connection')