diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-03-13 11:24:49 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-03-13 11:24:49 +1300 |
commit | c901cbbadada76adca83daa800d65919f44d912f (patch) | |
tree | 2a1c391a691598404a9980b85e83f9bf2052634d /libmproxy/flow.py | |
parent | 9a9a2d9125e6b1fbbfff0020ad0f29df74249f44 (diff) | |
download | mitmproxy-c901cbbadada76adca83daa800d65919f44d912f.tar.gz mitmproxy-c901cbbadada76adca83daa800d65919f44d912f.tar.bz2 mitmproxy-c901cbbadada76adca83daa800d65919f44d912f.zip |
mitmproxy prompted input now display previously set value.
E.g. if you set a limit, then re-enter the limit prompt, you start with the
currently set value.
Diffstat (limited to 'libmproxy/flow.py')
-rw-r--r-- | libmproxy/flow.py | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/libmproxy/flow.py b/libmproxy/flow.py index 4bcbbb97..7444b400 100644 --- a/libmproxy/flow.py +++ b/libmproxy/flow.py @@ -316,6 +316,7 @@ class State: # These are compiled filt expressions: self.limit = None self.intercept = None + self.limit_txt = None def flow_count(self): return len(self.flow_map) @@ -371,11 +372,27 @@ class State: for i in flows: self.flow_map[i.request] = i - def set_limit(self, limit): - """ - Limit is a compiled filter expression, or None. - """ - self.limit = limit + def set_limit(self, txt): + if txt: + f = filt.parse(txt) + if not f: + return "Invalid filter expression." + self.limit = f + self.limit_txt = txt + else: + self.limit = None + self.limit_txt = None + + def set_intercept(self, txt): + if txt: + f = filt.parse(txt) + if not f: + return "Invalid filter expression." + self.intercept = f + self.intercept_txt = txt + else: + self.intercept = None + self.intercept_txt = None @property def view(self): |