diff options
author | Matthias Urlichs <matthias@urlichs.de> | 2013-12-12 09:22:55 +0100 |
---|---|---|
committer | Matthias Urlichs <matthias@urlichs.de> | 2013-12-12 09:22:55 +0100 |
commit | 517e5e66885c79879938d618bfc9da23eba85c0d (patch) | |
tree | eba54b44d94098a3d9d9da53aaa6130bc6f8428c | |
parent | 7b6057fa64af6cd6becd1ce6b55a2c10f6bb3c85 (diff) | |
download | mitmproxy-517e5e66885c79879938d618bfc9da23eba85c0d.tar.gz mitmproxy-517e5e66885c79879938d618bfc9da23eba85c0d.tar.bz2 mitmproxy-517e5e66885c79879938d618bfc9da23eba85c0d.zip |
handle a hook changing connection parameters
-rw-r--r-- | libmproxy/proxy.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 1d238697..38356a93 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -140,11 +140,15 @@ class ProxyHandler(tcp.BaseHandler): single server connection - no multiplexing. If this assumption ever breaks, we'll have to do something different with the SNI host variable on the handler object. + + `conn_info` holds the initial connection's parameters. + The hook might change them. """ sc = self.server_conn if not sni: sni = host - if sc and (scheme, host, port, sni) != (sc.scheme, sc.host, sc.port, sc.sni): + conn_info = (scheme, host, port, sni) + if sc and conn_info != sc.conn_info: sc.terminate() self.server_conn = None self.log( @@ -160,6 +164,7 @@ class ProxyHandler(tcp.BaseHandler): try: self.server_conn = ServerConnection(self.config, scheme, host, port, sni) self.server_conn.request = request # the hook might need it + self.server_conn.conn_info = conn_info self.channel.ask(self.server_conn) self.server_conn.connect() except tcp.NetLibError, v: |