aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mitmproxy/tools/web/app.py10
-rw-r--r--mitmproxy/tools/web/master.py7
-rw-r--r--test/mitmproxy/tools/web/test_app.py4
3 files changed, 6 insertions, 15 deletions
diff --git a/mitmproxy/tools/web/app.py b/mitmproxy/tools/web/app.py
index 6552a3a1..9a447fe7 100644
--- a/mitmproxy/tools/web/app.py
+++ b/mitmproxy/tools/web/app.py
@@ -18,11 +18,9 @@ from mitmproxy import io
from mitmproxy import log
from mitmproxy import version
from mitmproxy import optmanager
-from mitmproxy import options
+from mitmproxy.tools.cmdline import CONFIG_PATH
import mitmproxy.tools.web.master # noqa
-CONFIG_PATH = os.path.join(options.CA_DIR, 'config.yaml')
-
def flow_to_json(flow: mitmproxy.flow.Flow) -> dict:
"""
@@ -454,10 +452,10 @@ class Options(RequestHandler):
raise APIError(400, "{}".format(err))
-class DumpOptions(RequestHandler):
+class SaveOptions(RequestHandler):
def post(self):
try:
- optmanager.save(self.master.options, CONFIG_PATH)
+ optmanager.save(self.master.options, CONFIG_PATH, True)
except Exception as err:
raise APIError(400, "{}".format(err))
@@ -487,7 +485,7 @@ class Application(tornado.web.Application):
(r"/settings", Settings),
(r"/clear", ClearAll),
(r"/options", Options),
- (r"/options/dump", DumpOptions)
+ (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 c2e7c4b1..dc5b2627 100644
--- a/mitmproxy/tools/web/master.py
+++ b/mitmproxy/tools/web/master.py
@@ -125,13 +125,6 @@ class WebMaster(master.Master):
"No web browser found. Please open a browser and point it to {}".format(web_url),
"info"
)
- unknown_opts = optmanager.load_paths(app.CONFIG_PATH)
- if unknown_opts == {}:
- self.add_log(
- "Load options configuration from {}.".format(app.CONFIG_PATH),
- "info"
- )
-
try:
iol.start()
except KeyboardInterrupt:
diff --git a/test/mitmproxy/tools/web/test_app.py b/test/mitmproxy/tools/web/test_app.py
index 119d7b1d..4d290284 100644
--- a/test/mitmproxy/tools/web/test_app.py
+++ b/test/mitmproxy/tools/web/test_app.py
@@ -263,8 +263,8 @@ class TestApp(tornado.testing.AsyncHTTPTestCase):
assert self.put_json("/options", {"wtf": True}).code == 400
assert self.put_json("/options", {"anticache": "foo"}).code == 400
- def test_option_dump(self):
- assert self.fetch("/options/dump", method="POST").code == 200
+ def test_option_save(self):
+ assert self.fetch("/options/save", method="POST").code == 200
def test_err(self):
with mock.patch("mitmproxy.tools.web.app.IndexHandler.get") as f: