From f7c5385679a6e10f707b744242dc8edcf1028bf7 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Sat, 22 Nov 2014 15:27:43 +0100 Subject: [PATCH] retain raw filter str on filt objects --- libmproxy/filt.py | 4 +++- libmproxy/flow.py | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libmproxy/filt.py b/libmproxy/filt.py index 7d2bd737f..5d2590965 100644 --- a/libmproxy/filt.py +++ b/libmproxy/filt.py @@ -343,7 +343,9 @@ bnf = _make() def parse(s): try: - return bnf.parseString(s, parseAll=True)[0] + filt = bnf.parseString(s, parseAll=True)[0] + filt.pattern = s + return filt except pp.ParseException: return None except ValueError: diff --git a/libmproxy/flow.py b/libmproxy/flow.py index 007136985..5abcb1ab1 100644 --- a/libmproxy/flow.py +++ b/libmproxy/flow.py @@ -346,11 +346,13 @@ class State(object): # These are compiled filt expressions: self._limit = None self.intercept = None - self._limit_txt = None @property def limit_txt(self): - return self._limit_txt + if self.filt: + return self.filt.pattern + else: + return None def flow_count(self): return len(self._flow_list) @@ -407,10 +409,8 @@ class State(object): if not f: return "Invalid filter expression." self._limit = f - self._limit_txt = txt else: self._limit = None - self._limit_txt = None self.recalculate_view() def set_intercept(self, txt):