mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-01-30 14:58:38 +00:00
use flt instead of filt for flowfilter expressions
This commit is contained in:
parent
76ae9fdbaa
commit
90898f9084
@ -25,7 +25,7 @@ Should give output something like this:
|
||||
> mitmproxy/controller 69 0 100%
|
||||
> mitmproxy/dump 150 0 100%
|
||||
> mitmproxy/encoding 39 0 100%
|
||||
> mitmproxy/filt 201 0 100%
|
||||
> mitmproxy/flowfilter 201 0 100%
|
||||
> mitmproxy/flow 891 0 100%
|
||||
> mitmproxy/proxy 427 0 100%
|
||||
> mitmproxy/script 27 0 100%
|
||||
|
@ -11,13 +11,13 @@ class FileStreamer:
|
||||
self.stream = None
|
||||
self.active_flows = set() # type: Set[models.Flow]
|
||||
|
||||
def start_stream_to_path(self, path, mode, filt):
|
||||
def start_stream_to_path(self, path, mode, flt):
|
||||
path = os.path.expanduser(path)
|
||||
try:
|
||||
f = open(path, mode)
|
||||
except IOError as v:
|
||||
return str(v)
|
||||
self.stream = io.FilteredFlowWriter(f, filt)
|
||||
self.stream = io.FilteredFlowWriter(f, flt)
|
||||
self.active_flows = set()
|
||||
|
||||
def configure(self, options, updated):
|
||||
|
@ -67,17 +67,17 @@ class FlowView(FlowList):
|
||||
|
||||
def _build(self, flows, flt=None):
|
||||
if flt:
|
||||
self.filt = flt
|
||||
self._list = list(filter(self.filt, flows))
|
||||
self.filter = flt
|
||||
self._list = list(filter(self.filter, flows))
|
||||
|
||||
def _add(self, f):
|
||||
if self.filt(f):
|
||||
if self.filter(f):
|
||||
self._list.append(f)
|
||||
|
||||
def _update(self, f):
|
||||
if f not in self._list:
|
||||
self._add(f)
|
||||
elif not self.filt(f):
|
||||
elif not self.filter(f):
|
||||
self._remove(f)
|
||||
|
||||
def _remove(self, f):
|
||||
@ -187,12 +187,12 @@ class State(object):
|
||||
self.flows = FlowStore()
|
||||
self.view = FlowView(self.flows, None)
|
||||
|
||||
# These are compiled filt expressions:
|
||||
# These are compiled filter expressions:
|
||||
self.intercept = None
|
||||
|
||||
@property
|
||||
def filter_txt(self):
|
||||
return getattr(self.view.filt, "pattern", None)
|
||||
return getattr(self.view.filter, "pattern", None)
|
||||
|
||||
def flow_count(self):
|
||||
return len(self.flows)
|
||||
|
@ -10,12 +10,12 @@ class TestDumpMaster(mastertest.MasterTest):
|
||||
mastertest.MasterTest.dummy_cycle(self, master, n, content)
|
||||
return master.options.tfile.getvalue()
|
||||
|
||||
def mkmaster(self, filt, **options):
|
||||
def mkmaster(self, flt, **options):
|
||||
if "verbosity" not in options:
|
||||
options["verbosity"] = 0
|
||||
if "flow_detail" not in options:
|
||||
options["flow_detail"] = 0
|
||||
o = dump.Options(filtstr=filt, tfile=StringIO(), **options)
|
||||
o = dump.Options(filtstr=flt, tfile=StringIO(), **options)
|
||||
return dump.DumpMaster(None, o)
|
||||
|
||||
def test_basic(self):
|
||||
|
Loading…
Reference in New Issue
Block a user