From 097b566e54fa8b2138891fc9d1458bdd42ae7c28 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 8 Jul 2012 23:49:44 +1200 Subject: Handle new netlib.tcp.NetLibDisconnect exception. --- libmproxy/proxy.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 1a802e8f..bc7051d4 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -199,11 +199,11 @@ class ProxyHandler(tcp.BaseHandler): # disconnect. if http.response_connection_close(response.httpversion, response.headers): return - except (IOError, ProxyError, http.HttpError), e: - if isinstance(e, IOError): - cc.error = str(e) - else: + except (IOError, ProxyError, http.HttpError, tcp.NetLibDisconnect), e: + if hasattr(e, "code"): cc.error = "%s: %s"%(e.code, e.msg) + else: + cc.error = str(e) if request: err = flow.Error(request, cc.error) -- cgit v1.2.3