diff options
Diffstat (limited to 'libmproxy/proxy')
-rw-r--r-- | libmproxy/proxy/modes/socks_proxy.py | 8 | ||||
-rw-r--r-- | libmproxy/proxy/root_context.py | 4 | ||||
-rw-r--r-- | libmproxy/proxy/server.py | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/libmproxy/proxy/modes/socks_proxy.py b/libmproxy/proxy/modes/socks_proxy.py index 545c38d6..1eb7db5b 100644 --- a/libmproxy/proxy/modes/socks_proxy.py +++ b/libmproxy/proxy/modes/socks_proxy.py @@ -1,9 +1,9 @@ from __future__ import (absolute_import, print_function, division) from netlib import socks -from netlib.tcp import NetLibError +from netlib.exceptions import TcpException -from ...exceptions import Socks5Exception +from ...exceptions import Socks5ProtocolException from ...protocol import Layer, ServerConnectionMixin @@ -47,8 +47,8 @@ class Socks5Proxy(Layer, ServerConnectionMixin): connect_reply.to_file(self.client_conn.wfile) self.client_conn.wfile.flush() - except (socks.SocksError, NetLibError) as e: - raise Socks5Exception("SOCKS5 mode failure: %s" % repr(e)) + except (socks.SocksError, TcpException) as e: + raise Socks5ProtocolException("SOCKS5 mode failure: %s" % repr(e)) self.server_conn.address = connect_request.addr diff --git a/libmproxy/proxy/root_context.py b/libmproxy/proxy/root_context.py index 72243c59..48cb72a0 100644 --- a/libmproxy/proxy/root_context.py +++ b/libmproxy/proxy/root_context.py @@ -5,8 +5,8 @@ import sys import six from libmproxy.exceptions import ProtocolException +from netlib.exceptions import TcpException from netlib.http import ALPN_PROTO_H2, ALPN_PROTO_HTTP1 -from netlib.tcp import NetLibError from ..protocol import ( RawTCPLayer, TlsLayer, Http1Layer, Http2Layer, is_tls_record_magic, ServerConnectionMixin ) @@ -54,7 +54,7 @@ class RootContext(object): try: d = top_layer.client_conn.rfile.peek(3) - except NetLibError as e: + except TcpException as e: six.reraise(ProtocolException, ProtocolException(str(e)), sys.exc_info()[2]) client_tls = is_tls_record_magic(d) diff --git a/libmproxy/proxy/server.py b/libmproxy/proxy/server.py index 8b286458..8531b6dc 100644 --- a/libmproxy/proxy/server.py +++ b/libmproxy/proxy/server.py @@ -6,8 +6,8 @@ import socket import six from netlib import tcp +from netlib.exceptions import TcpException from netlib.http.http1 import assemble_response -from netlib.tcp import NetLibError from ..exceptions import ProtocolException, ServerException, ClientHandshakeException from ..protocol import Kill from ..models import ClientConnection, make_error_response @@ -139,7 +139,7 @@ class ConnectionHandler(object): try: error_response = make_error_response(502, repr(e)) self.client_conn.send(assemble_response(error_response)) - except NetLibError: + except TcpException: pass except Exception: self.log(traceback.format_exc(), "error") |