aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mitmproxy/command.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/mitmproxy/command.py b/mitmproxy/command.py
index 609e288c..f2a87e1e 100644
--- a/mitmproxy/command.py
+++ b/mitmproxy/command.py
@@ -236,8 +236,20 @@ class CommandManager(mitmproxy.types._CommandBase):
parts, _ = self.parse_partial(cmdstr)
params = []
for p in parts:
- if p.value.strip() != '':
- params.append(p.value)
+ v = p.value.strip()
+ if v != '':
+ if ((v.startswith("'") and v.endswith("'")) or
+ (v.startswith("\"") and v.endswith("\""))) and \
+ len(v.split(' ')) == 1:
+ # If this parameter is between quotes but has no spaces in
+ # it, then it is safe to remove the quotes to pass it down
+ # This allows any commands that take a simple spaceless
+ # string as a parameter to work. For example
+ # view.flows.create get "http://www.example.com" won't work
+ # if the quotes are there as it won't see the param as a URL
+ v = v[1:-1]
+
+ params.append(v)
if len(parts) == 0:
raise exceptions.CommandError("Invalid command: %s" % cmdstr)