diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-03-09 13:15:31 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-03-09 13:15:31 +1300 |
commit | 03f13453856e3af15dc3af81adcf3a80d1358da0 (patch) | |
tree | f4700518429e2264ee083034f2b91aa7425ce5e8 /libmproxy/proxy.py | |
parent | 592812467da5bfe8196f16dcfa6d348551c4febd (diff) | |
download | mitmproxy-03f13453856e3af15dc3af81adcf3a80d1358da0.tar.gz mitmproxy-03f13453856e3af15dc3af81adcf3a80d1358da0.tar.bz2 mitmproxy-03f13453856e3af15dc3af81adcf3a80d1358da0.zip |
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.
Diffstat (limited to 'libmproxy/proxy.py')
-rw-r--r-- | libmproxy/proxy.py | 13 |
1 files changed, 13 insertions, 0 deletions
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 |