aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libmproxy/cmdline.py6
-rw-r--r--libmproxy/console.py20
-rw-r--r--libmproxy/dump.py6
-rw-r--r--libmproxy/flow.py1
-rw-r--r--libmproxy/proxy.py1
5 files changed, 24 insertions, 10 deletions
diff --git a/libmproxy/cmdline.py b/libmproxy/cmdline.py
index 7d32f191..f4d0e430 100644
--- a/libmproxy/cmdline.py
+++ b/libmproxy/cmdline.py
@@ -17,6 +17,7 @@ def get_common_options(options):
return dict(
anticache = options.anticache,
anticomp = options.anticomp,
+ autodecode = options.autodecode,
client_replay = options.client_replay,
kill = options.kill,
no_server = options.no_server,
@@ -40,6 +41,11 @@ def common_options(parser):
help = "Address to bind proxy to (defaults to all interfaces)"
)
parser.add_option(
+ "-d",
+ action="store_true", dest="autodecode",
+ help="Automatically decode compressed server responses."
+ )
+ parser.add_option(
"--confdir",
action="store", type = "str", dest="confdir", default='~/.mitmproxy',
help = "Configuration directory. (~/.mitmproxy)"
diff --git a/libmproxy/console.py b/libmproxy/console.py
index c76f9314..3017669e 100644
--- a/libmproxy/console.py
+++ b/libmproxy/console.py
@@ -311,9 +311,8 @@ class ConnectionView(WWrap):
def _conn_text(self, conn, viewmode):
if conn:
e = conn.headers["content-encoding"]
- if e and conn.should_autodecode:
+ if e and self.master.autodecode:
e = e[0]
- conn.should_autodecode = False
else:
e = "identity"
return self.master._cached_conn_text(
@@ -673,6 +672,8 @@ class StatusBar(WWrap):
opts.append("anticache")
if self.master.anticomp:
opts.append("anticomp")
+ if self.master.autodecode:
+ opts.append("autodecode")
if not self.master.refresh_server_playback:
opts.append("norefresh")
if self.master.killextra:
@@ -806,6 +807,7 @@ class Options(object):
__slots__ = [
"anticache",
"anticomp",
+ "autodecode",
"client_replay",
"debug",
"keepserving",
@@ -886,6 +888,7 @@ class ConsoleMaster(flow.FlowMaster):
self.refresh_server_playback = options.refresh_server_playback
self.anticache = options.anticache
self.anticomp = options.anticomp
+ self.autodecode = options.autodecode
self.killextra = options.kill
self.rheaders = options.rheaders
@@ -1276,17 +1279,17 @@ class ConsoleMaster(flow.FlowMaster):
("o", "toggle options:"),
(None,
highlight_key("anticache", "a") +
- [
-
- ("text", ": modify requests to prevent cached responses")
-
- ]
+ [("text", ": modify requests to prevent cached responses")]
),
(None,
highlight_key("anticomp", "c") +
[("text", ": modify requests to try to prevent compressed responses")]
),
(None,
+ highlight_key("autodecode", "d") +
+ [("text", ": automatically decode compressed responses")]
+ ),
+ (None,
highlight_key("killextra", "k") +
[("text", ": kill requests not part of server replay")]
),
@@ -1581,6 +1584,7 @@ class ConsoleMaster(flow.FlowMaster):
(
("anticache", "a"),
("anticomp", "c"),
+ ("autodecode", "d"),
("killextra", "k"),
("norefresh", "n"),
),
@@ -1624,6 +1628,8 @@ class ConsoleMaster(flow.FlowMaster):
self.anticache = not self.anticache
if a == "c":
self.anticomp = not self.anticomp
+ elif a == "d":
+ self.autodecode = not self.autodecode
elif a == "k":
self.killextra = not self.killextra
elif a == "n":
diff --git a/libmproxy/dump.py b/libmproxy/dump.py
index c68b747e..972b9f2f 100644
--- a/libmproxy/dump.py
+++ b/libmproxy/dump.py
@@ -8,6 +8,7 @@ class Options(object):
__slots__ = [
"anticache",
"anticomp",
+ "autodecode",
"client_replay",
"keepserving",
"kill",
@@ -56,6 +57,7 @@ class DumpMaster(flow.FlowMaster):
self.o = options
self.anticache = options.anticache
self.anticomp = options.anticomp
+ self.autodecode = options.autodecode
self.refresh_server_playback = options.refresh_server_playback
if filtstr:
@@ -64,9 +66,9 @@ class DumpMaster(flow.FlowMaster):
self.filt = None
if self.o.response_script:
- self.set_response_script(self.o.response_script)
+ self.set_response_script(self.o.response_script)
if self.o.request_script:
- self.set_request_script(self.o.request_script)
+ self.set_request_script(self.o.request_script)
if options.stickycookie:
self.set_stickycookie(options.stickycookie)
diff --git a/libmproxy/flow.py b/libmproxy/flow.py
index 568ec3d1..13b5acbc 100644
--- a/libmproxy/flow.py
+++ b/libmproxy/flow.py
@@ -454,6 +454,7 @@ class FlowMaster(controller.Master):
self.anticache = False
self.anticomp = False
+ self.autodecode = False
self.refresh_server_playback = False
def _runscript(self, f, script):
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py
index 4ff96c4f..abaad255 100644
--- a/libmproxy/proxy.py
+++ b/libmproxy/proxy.py
@@ -291,7 +291,6 @@ class Response(controller.Msg):
controller.Msg.__init__(self)
self.replay = False
self.last_encoding = None
- self.should_autodecode = True
def _refresh_cookie(self, c, delta):
"""