fix web master options leftovers

This commit is contained in:
Maximilian Hils 2016-07-19 03:11:17 -07:00
parent 329909c514
commit 4ea6e61ea8
2 changed files with 8 additions and 7 deletions

View File

@ -118,6 +118,7 @@ class RequestHandler(BasicAuth, tornado.web.RequestHandler):
@property @property
def master(self): def master(self):
# type: () -> mitmproxy.web.master.WebMaster
return self.application.master return self.application.master
@property @property
@ -337,7 +338,7 @@ class Settings(RequestHandler):
data=dict( data=dict(
version=version.VERSION, version=version.VERSION,
mode=str(self.master.options.mode), mode=str(self.master.options.mode),
intercept=self.state.intercept_txt, intercept=self.master.options.intercept,
showhost=self.master.options.showhost, showhost=self.master.options.showhost,
no_upstream_cert=self.master.options.no_upstream_cert, no_upstream_cert=self.master.options.no_upstream_cert,
rawtcp=self.master.options.rawtcp, rawtcp=self.master.options.rawtcp,
@ -345,8 +346,8 @@ class Settings(RequestHandler):
anticache=self.master.options.anticache, anticache=self.master.options.anticache,
anticomp=self.master.options.anticomp, anticomp=self.master.options.anticomp,
stickyauth=self.master.options.stickyauth, stickyauth=self.master.options.stickyauth,
stickycookie=self.master.stickycookie_txt, stickycookie=self.master.options.stickycookie,
stream= self.master.stream_large_bodies.max_size if self.master.stream_large_bodies else False stream= self.master.options.stream_large_bodies
) )
)) ))
@ -354,7 +355,7 @@ class Settings(RequestHandler):
update = {} update = {}
for k, v in six.iteritems(self.json): for k, v in six.iteritems(self.json):
if k == "intercept": if k == "intercept":
self.state.set_intercept(v) self.master.options.intercept = v
update[k] = v update[k] = v
elif k == "showhost": elif k == "showhost":
self.master.options.showhost = v self.master.options.showhost = v
@ -375,13 +376,13 @@ class Settings(RequestHandler):
self.master.options.anticomp = v self.master.options.anticomp = v
update[k] = v update[k] = v
elif k == "stickycookie": elif k == "stickycookie":
self.master.set_stickycookie(v) self.master.options.stickycookie = v
update[k] = v update[k] = v
elif k == "stickyauth": elif k == "stickyauth":
self.master.options.stickyauth = v self.master.options.stickyauth = v
update[k] = v update[k] = v
elif k == "stream": elif k == "stream":
self.master.set_stream_large_bodies(v) self.master.options.stream_large_bodies = v
update[k] = v update[k] = v
else: else:
print("Warning: Unknown setting {}: {}".format(k, v)) print("Warning: Unknown setting {}: {}".format(k, v))

View File

@ -94,7 +94,7 @@ class WebState(flow.State):
class Options(flow.options.Options): class Options(flow.options.Options):
def __init__( def __init__(
self, self,
intercept=False, # type: bool intercept=None, # type: Optional[str]
wdebug=bool, # type: bool wdebug=bool, # type: bool
wport=8081, # type: int wport=8081, # type: int
wiface="127.0.0.1", # type: str wiface="127.0.0.1", # type: str