mhils / HoneyProxy

This project is now part of @mitmproxy.
https://github.com/mitmproxy/mitmproxy/
MIT License
198 stars 43 forks source link

Improve parsing of config files - quoted strings with spaces should not be split. #69

Closed domenpk closed 11 years ago

domenpk commented 11 years ago

Testcase: --replace-from-file "/~s/function init(){/testfile.js"

Patch:

--- libhproxy/cmdline.py.orig   2013-01-22 10:35:12.000000000 +0000
+++ libhproxy/cmdline.py        2013-06-05 10:46:39.733490634 +0100
@@ -1,4 +1,5 @@
 import argparse
+import shlex
 """
 see mitmproxy/libmproxy/cmdline
 we remove all unwanted parameters and add everything we need for HoneyProxy
@@ -16,7 +17,7 @@
 def convert_arg_line_to_args(self, arg_line):
     if arg_line.lstrip().startswith("#"):
         return
-    for arg in arg_line.split():
+    for arg in shlex.split(arg_line):
         if not arg.strip():
             continue
         yield arg
mhils commented 11 years ago

Gnarf, stupid one. Thanks for pointing this out. I will commit your fix later today.

Thanks!