aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy
diff options
context:
space:
mode:
Diffstat (limited to 'libmproxy')
-rw-r--r--libmproxy/dump.py11
-rw-r--r--libmproxy/flow.py3
-rw-r--r--libmproxy/proxy.py13
3 files changed, 23 insertions, 4 deletions
diff --git a/libmproxy/dump.py b/libmproxy/dump.py
index 73ecc54d..5cbb7389 100644
--- a/libmproxy/dump.py
+++ b/libmproxy/dump.py
@@ -6,16 +6,17 @@ class DumpError(Exception): pass
class Options(object):
__slots__ = [
+ "anticache",
+ "client_replay",
+ "keepserving",
"kill",
"request_script",
"response_script",
+ "rheaders",
"server_replay",
- "client_replay",
+ "stickycookie",
"verbosity",
"wfile",
- "rheaders",
- "stickycookie",
- "keepserving",
]
def __init__(self, **kwargs):
for k, v in kwargs.items():
@@ -83,6 +84,8 @@ class DumpMaster(flow.FlowMaster):
not options.keepserving
)
+ self.anticache = options.anticache
+
def _readflow(self, path):
path = os.path.expanduser(path)
try:
diff --git a/libmproxy/flow.py b/libmproxy/flow.py
index dff58fa0..0080f1d4 100644
--- a/libmproxy/flow.py
+++ b/libmproxy/flow.py
@@ -432,6 +432,7 @@ class FlowMaster(controller.Master):
self.scripts = {}
self.kill_nonreplay = False
self.stickycookie_state = False
+ self.anticache = False
def _runscript(self, f, script):
#begin nocover
@@ -521,6 +522,8 @@ class FlowMaster(controller.Master):
self.stickycookie_state.handle_request(f)
if "request" in self.scripts:
self._runscript(f, self.scripts["request"])
+ if self.anticache:
+ r.anticache()
if self.server_playback:
pb = self.do_server_playback(f)
if not pb:
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py
index a4dc3e69..48884c09 100644
--- a/libmproxy/proxy.py
+++ b/libmproxy/proxy.py
@@ -139,6 +139,19 @@ class Request(controller.Msg):
# Have this request's cookies been modified by sticky cookies?
self.stickycookie = False
+ def anticache(self):
+ """
+ Modifies this request to remove headers that might produce a cached
+ response. That is, we remove ETags and If-Modified-Since headers.
+ """
+ delheaders = [
+ "if-modified-since",
+ "if-none-match",
+ ]
+ for i in delheaders:
+ if i in self.headers:
+ del self.headers[i]
+
def set_replay(self):
self.client_conn = None