From f32c180d4c28ddffb235a24cb49763141e0e1b97 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Fri, 13 Jan 2012 08:20:49 -0500 Subject: avoid traceback for socket.error during proxy --- src/lib/Proxy.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/lib/Proxy.py b/src/lib/Proxy.py index 9d0197798..c340cadda 100644 --- a/src/lib/Proxy.py +++ b/src/lib/Proxy.py @@ -22,10 +22,12 @@ import socket try: import ssl SSL_LIB = 'py26_ssl' + SSL_ERROR = ssl.SSLError except ImportError: from M2Crypto import SSL import M2Crypto.SSL.Checker SSL_LIB = 'm2crypto' + SSL_ERROR = SSL.SSLError import sys @@ -305,14 +307,9 @@ class XMLRPCTransport(xmlrpclib.Transport): self.send_user_agent(h) self.send_content(h, request_body) - if SSL_LIB == 'py26_ssl': - catch = ssl.SSLError - elif SSL_LIB == 'm2crypto': - catch = SSL.SSLError - try: errcode, errmsg, headers = h.getreply() - except catch: + except (socket.error, SSL_ERROR): err = sys.exc_info()[1] raise ProxyError(xmlrpclib.ProtocolError(host + handler, 408, -- cgit v1.2.3-1-g7c22