diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-08-08 16:08:57 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-08-11 20:32:13 +0200 |
commit | 026330a3b014f24f095b839b29186036854de3bc (patch) | |
tree | c5770ef28332b61f56b5435136e8dcd95340ed1d /libmproxy/protocol2/layer.py | |
parent | 314e0f5839fcd4a1c35323f61938b207232de287 (diff) | |
download | mitmproxy-026330a3b014f24f095b839b29186036854de3bc.tar.gz mitmproxy-026330a3b014f24f095b839b29186036854de3bc.tar.bz2 mitmproxy-026330a3b014f24f095b839b29186036854de3bc.zip |
cleaner Exceptions, ssl -> tls, upstream proxy mode
Diffstat (limited to 'libmproxy/protocol2/layer.py')
-rw-r--r-- | libmproxy/protocol2/layer.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libmproxy/protocol2/layer.py b/libmproxy/protocol2/layer.py index c18be83c..8aede22e 100644 --- a/libmproxy/protocol2/layer.py +++ b/libmproxy/protocol2/layer.py @@ -35,9 +35,10 @@ from __future__ import (absolute_import, print_function, division) import Queue import threading from netlib import tcp -from ..proxy import ProxyError2, Log +from ..proxy import Log from ..proxy.connection import ServerConnection from .messages import Connect, Reconnect, ChangeServer +from ..exceptions import ProtocolException class RootContext(object): @@ -51,6 +52,9 @@ class RootContext(object): self.channel = channel # provides .ask() method to communicate with FlowMaster self.config = config # Proxy Configuration + def next_layer(self): + print(type(self)) + class _LayerCodeCompletion(object): """ @@ -149,7 +153,7 @@ class ServerConnectionMixin(object): try: self.server_conn.connect() except tcp.NetLibError as e: - raise ProxyError2("Server connection to '%s' failed: %s" % (self.server_address, e), e) + raise ProtocolException("Server connection to '%s' failed: %s" % (self.server_address, e), e) def yield_from_callback(fun): @@ -197,7 +201,7 @@ def yield_from_callback(fun): break elif isinstance(msg, Exception): # TODO: Include func name? - raise ProxyError2("Error in %s: %s" % (fun.__name__, repr(msg)), msg) + raise ProtocolException("Error in %s: %s" % (fun.__name__, repr(msg)), msg) else: yield msg yield_queue.put(None) |