diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-08-16 23:25:02 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-08-16 23:25:02 +0200 |
commit | a2b85048892626e6834df06e9022498814724636 (patch) | |
tree | 4b020376b618617c44355710aba4cbd6ba82b6b0 /libmproxy/proxy/server.py | |
parent | c04fa1b233224d28e85be34ab5b6a8718497488c (diff) | |
download | mitmproxy-a2b85048892626e6834df06e9022498814724636.tar.gz mitmproxy-a2b85048892626e6834df06e9022498814724636.tar.bz2 mitmproxy-a2b85048892626e6834df06e9022498814724636.zip |
improve protocol handling
Diffstat (limited to 'libmproxy/proxy/server.py')
-rw-r--r-- | libmproxy/proxy/server.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libmproxy/proxy/server.py b/libmproxy/proxy/server.py index ffca55ee..e23a7d72 100644 --- a/libmproxy/proxy/server.py +++ b/libmproxy/proxy/server.py @@ -80,7 +80,12 @@ class ConnectionHandler2: self.config, self.channel ) - root_layer = protocol2.HttpProxy(root_context) + + # FIXME: properly parse config + if self.config.mode == "upstream": + root_layer = protocol2.HttpUpstreamProxy(root_context, ("localhost", 8081)) + else: + root_layer = protocol2.HttpProxy(root_context) try: for message in root_layer(): @@ -302,7 +307,7 @@ class ConnectionHandler: if ssl_cert_err is not None: self.log( "SSL verification failed for upstream server at depth %s with error: %s" % - (ssl_cert_err['depth'], ssl_cert_err['errno']), + (ssl_cert_err['depth'], ssl_cert_err['errno']), "error") self.log("Ignoring server verification error, continuing with connection", "error") except tcp.NetLibError as v: @@ -318,7 +323,7 @@ class ConnectionHandler: if ssl_cert_err is not None: self.log( "SSL verification failed for upstream server at depth %s with error: %s" % - (ssl_cert_err['depth'], ssl_cert_err['errno']), + (ssl_cert_err['depth'], ssl_cert_err['errno']), "error") self.log("Aborting connection attempt", "error") raise e |