From 03f13453856e3af15dc3af81adcf3a80d1358da0 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Wed, 9 Mar 2011 13:15:31 +1300 Subject: Add an --anticache option to mitmdump. This removes all headers that might cause a server to return 304-not-modified. For now, all the new features are going into mitmdump - everything will be ported over to mitmproxy once I have the feature set locked down. --- libmproxy/proxy.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libmproxy/proxy.py') 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 -- cgit v1.2.3