diff options
Diffstat (limited to 'libmproxy')
-rw-r--r-- | libmproxy/console/connlist.py | 4 | ||||
-rw-r--r-- | libmproxy/flow.py | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/libmproxy/console/connlist.py b/libmproxy/console/connlist.py index 957e797b..177c64e7 100644 --- a/libmproxy/console/connlist.py +++ b/libmproxy/console/connlist.py @@ -11,6 +11,7 @@ def _mkhelp(): ("e", "toggle eventlog"), ("l", "set limit filter pattern"), ("L", "load saved flows"), + ("p", "duplicate flow"), ("r", "replay request"), ("R", "revert changes to request"), ("w", "save all flows matching current limit"), @@ -110,6 +111,9 @@ class ConnectionItem(common.WWrap): self.state.last_saveload, self.master.load_flows_callback ) + elif key == "p": + f = self.master.duplicate_flow(self.flow) + self.master.conn_list_view.set_focus(self.state.index(f)) elif key == "r": r = self.master.replay_request(self.flow) if r: diff --git a/libmproxy/flow.py b/libmproxy/flow.py index 8ce25c5c..db4cde5e 100644 --- a/libmproxy/flow.py +++ b/libmproxy/flow.py @@ -856,8 +856,10 @@ class Flow: f = Flow(rc) if self.response: f.response = self.response.copy() + f.response.request = rc if self.error: f.error = self.error.copy() + f.error.request = rc return f @classmethod @@ -1006,6 +1008,9 @@ class State(object): def flow_count(self): return len(self._flow_map) + def index(self, f): + return self._flow_list.index(f) + def active_flow_count(self): c = 0 for i in self._flow_list: @@ -1249,6 +1254,9 @@ class FlowMaster(controller.Master): return self.load_flow(f.copy()) def load_flow(self, f): + """ + Loads a flow, and returns a new flow object. + """ if f.request: fr = self.handle_request(f.request) if f.response: |