aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2017-07-27 13:11:16 +0200
committerGitHub <noreply@github.com>2017-07-27 13:11:16 +0200
commit357928b0cdfd89e8a7cce8c776bb5eb16a8c4401 (patch)
treec8ad6cd0378298f7fe7d8570088c3c5c6951f7eb /mitmproxy
parent874d0aa25367274c46f6b8ba2a91def66503407e (diff)
parent7e5f424c5013a591e71f570b003e34f8e6788869 (diff)
downloadmitmproxy-357928b0cdfd89e8a7cce8c776bb5eb16a8c4401.tar.gz
mitmproxy-357928b0cdfd89e8a7cce8c776bb5eb16a8c4401.tar.bz2
mitmproxy-357928b0cdfd89e8a7cce8c776bb5eb16a8c4401.zip
Merge pull request #2460 from MatthewShao/mitmweb-options
Add default value suggester in mitmweb options
Diffstat (limited to 'mitmproxy')
-rw-r--r--mitmproxy/tools/web/app.py12
-rw-r--r--mitmproxy/tools/web/master.py1
2 files changed, 11 insertions, 2 deletions
diff --git a/mitmproxy/tools/web/app.py b/mitmproxy/tools/web/app.py
index c6fb2ef6..9a447fe7 100644
--- a/mitmproxy/tools/web/app.py
+++ b/mitmproxy/tools/web/app.py
@@ -18,6 +18,7 @@ from mitmproxy import io
from mitmproxy import log
from mitmproxy import version
from mitmproxy import optmanager
+from mitmproxy.tools.cmdline import CONFIG_PATH
import mitmproxy.tools.web.master # noqa
@@ -451,6 +452,14 @@ class Options(RequestHandler):
raise APIError(400, "{}".format(err))
+class SaveOptions(RequestHandler):
+ def post(self):
+ try:
+ optmanager.save(self.master.options, CONFIG_PATH, True)
+ except Exception as err:
+ raise APIError(400, "{}".format(err))
+
+
class Application(tornado.web.Application):
def __init__(self, master, debug):
self.master = master
@@ -475,7 +484,8 @@ class Application(tornado.web.Application):
FlowContentView),
(r"/settings", Settings),
(r"/clear", ClearAll),
- (r"/options", Options)
+ (r"/options", Options),
+ (r"/options/save", SaveOptions)
]
settings = dict(
template_path=os.path.join(os.path.dirname(__file__), "templates"),
diff --git a/mitmproxy/tools/web/master.py b/mitmproxy/tools/web/master.py
index 8c2433ec..dc5b2627 100644
--- a/mitmproxy/tools/web/master.py
+++ b/mitmproxy/tools/web/master.py
@@ -125,7 +125,6 @@ class WebMaster(master.Master):
"No web browser found. Please open a browser and point it to {}".format(web_url),
"info"
)
-
try:
iol.start()
except KeyboardInterrupt: