From 310fb18aac972123e0b25e618978d4dce7031078 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Thu, 5 Feb 2015 15:24:32 +0100 Subject: fix #464 --- libmproxy/protocol/tcp.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libmproxy/protocol/tcp.py') diff --git a/libmproxy/protocol/tcp.py b/libmproxy/protocol/tcp.py index da0c9087..d2d21829 100644 --- a/libmproxy/protocol/tcp.py +++ b/libmproxy/protocol/tcp.py @@ -3,6 +3,7 @@ import select import socket from .primitives import ProtocolHandler from netlib.utils import cleanBin +from netlib.tcp import NetLibError class TCPHandler(ProtocolHandler): @@ -76,7 +77,8 @@ class TCPHandler(ProtocolHandler): ), "info" ) - dst.connection.send(contents) + # Do not use dst.connection.send here, which may raise OpenSSL-specific errors. + dst.send(contents) else: # socket.socket.send supports raw bytearrays/memoryviews if self.log: @@ -87,6 +89,6 @@ class TCPHandler(ProtocolHandler): "info" ) dst.connection.send(buf[:size]) - except socket.error as e: + except (socket.error, NetLibError) as e: self.c.log("TCP connection closed unexpectedly.", "debug") return -- cgit v1.2.3