aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/command.py
diff options
context:
space:
mode:
authorHenrique <typoon@gmail.com>2019-11-17 10:24:49 -0500
committerHenrique <typoon@gmail.com>2019-11-17 10:24:49 -0500
commit39a6d4860ce48e4663a7aa91651dbea639e93e96 (patch)
treefa7419a14a6cf3698886dc9568a8851ca17b7578 /mitmproxy/command.py
parentfbcaab2abaf713d9e11770b0cb22c9068dcef2ae (diff)
downloadmitmproxy-39a6d4860ce48e4663a7aa91651dbea639e93e96.tar.gz
mitmproxy-39a6d4860ce48e4663a7aa91651dbea639e93e96.tar.bz2
mitmproxy-39a6d4860ce48e4663a7aa91651dbea639e93e96.zip
Fixed issue with string parameters between quotes that do not have a
space
Diffstat (limited to 'mitmproxy/command.py')
-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)