diff --git a/libmproxy/dump.py b/libmproxy/dump.py index 7eff4992e..039fb9a74 100644 --- a/libmproxy/dump.py +++ b/libmproxy/dump.py @@ -20,6 +20,8 @@ class DumpMaster(flow.FlowMaster): def handle_response(self, msg): f = flow.FlowMaster.handle_response(self, msg) + if not f: + return if 0 < self.verbosity < 3: print >> self.outfile, ">>", print >> self.outfile, msg.request.short() @@ -41,6 +43,8 @@ class DumpMaster(flow.FlowMaster): print >> self.outfile, "\t", i print >> self.outfile, "<<" msg.ack() + self.state.delete_flow(f) + print [i.get_state() for i in self.state.flow_list] # begin nocover diff --git a/libmproxy/flow.py b/libmproxy/flow.py index 5aba5f76a..63da0230a 100644 --- a/libmproxy/flow.py +++ b/libmproxy/flow.py @@ -183,7 +183,8 @@ class State: """ f = self.flow_map.get(req.client_conn) if not f: - return False + f = Flow(req.client_conn) + self.add_browserconnect(f) f.request = req return f diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index ff0d9a965..54ff2ec30 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -454,8 +454,8 @@ class ProxyHandler(SocketServer.StreamRequestHandler): def handle(self): cc = ClientConnection(self.client_address) + cc.send(self.mqueue) while not cc.close: - cc.send(self.mqueue) self.handle_request(cc) cc = cc.copy() self.finish() @@ -471,6 +471,7 @@ class ProxyHandler(SocketServer.StreamRequestHandler): if request is None: cc.close = True return + if request.is_response(): response = request request = False