Don't leave dangling browser connections for pipelined requests.

This commit is contained in:
Aldo Cortesi 2011-02-16 22:37:04 +13:00
parent 0dd1aa7cc7
commit 8a9f20b78c
3 changed files with 8 additions and 2 deletions

View File

@ -20,6 +20,8 @@ class DumpMaster(flow.FlowMaster):
def handle_response(self, msg): def handle_response(self, msg):
f = flow.FlowMaster.handle_response(self, msg) f = flow.FlowMaster.handle_response(self, msg)
if not f:
return
if 0 < self.verbosity < 3: if 0 < self.verbosity < 3:
print >> self.outfile, ">>", print >> self.outfile, ">>",
print >> self.outfile, msg.request.short() print >> self.outfile, msg.request.short()
@ -41,6 +43,8 @@ class DumpMaster(flow.FlowMaster):
print >> self.outfile, "\t", i print >> self.outfile, "\t", i
print >> self.outfile, "<<" print >> self.outfile, "<<"
msg.ack() msg.ack()
self.state.delete_flow(f)
print [i.get_state() for i in self.state.flow_list]
# begin nocover # begin nocover

View File

@ -183,7 +183,8 @@ class State:
""" """
f = self.flow_map.get(req.client_conn) f = self.flow_map.get(req.client_conn)
if not f: if not f:
return False f = Flow(req.client_conn)
self.add_browserconnect(f)
f.request = req f.request = req
return f return f

View File

@ -454,8 +454,8 @@ class ProxyHandler(SocketServer.StreamRequestHandler):
def handle(self): def handle(self):
cc = ClientConnection(self.client_address) cc = ClientConnection(self.client_address)
cc.send(self.mqueue)
while not cc.close: while not cc.close:
cc.send(self.mqueue)
self.handle_request(cc) self.handle_request(cc)
cc = cc.copy() cc = cc.copy()
self.finish() self.finish()
@ -471,6 +471,7 @@ class ProxyHandler(SocketServer.StreamRequestHandler):
if request is None: if request is None:
cc.close = True cc.close = True
return return
if request.is_response(): if request.is_response():
response = request response = request
request = False request = False