From be1377850ed85506a1b0fb4eeca2bd686cdc4b71 Mon Sep 17 00:00:00 2001 From: Matthias Urlichs Date: Wed, 26 Jun 2013 15:00:33 +0200 Subject: [PATCH 1/2] Close connection when flush fails --- libmproxy/proxy.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 283072ab8..69873a38d 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -88,6 +88,9 @@ class ServerConnection(tcp.TCPClient): def terminate(self): try: self.wfile.flush() + except IOError: + pass + try: self.connection.close() except IOError: pass From d9cc6f1dd6dfecdc4fe3ef38d2a7c5671f169c5e Mon Sep 17 00:00:00 2001 From: Matthias Urlichs Date: Fri, 28 Jun 2013 07:53:56 +0200 Subject: [PATCH 2/2] proxy.py: Catch channel.ask() returning None when terminating --- libmproxy/proxy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 69873a38d..8dfae77aa 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -216,7 +216,7 @@ class ProxyHandler(tcp.BaseHandler): return else: request_reply = self.channel.ask(request) - if request_reply == KILL: + if request_reply is None or request_reply == KILL: return elif isinstance(request_reply, flow.Response): request = False