diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-12-02 21:19:41 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-12-02 21:19:41 +0100 |
commit | d1ce1aa993eb431a0db9048a42830c1234571c29 (patch) | |
tree | 693331a05bba66750dde8c7ab841751f48b145f3 | |
parent | 7274edce0584eaf47d5c4d6d9b648af4d9a95d9a (diff) | |
download | mitmproxy-d1ce1aa993eb431a0db9048a42830c1234571c29.tar.gz mitmproxy-d1ce1aa993eb431a0db9048a42830c1234571c29.tar.bz2 mitmproxy-d1ce1aa993eb431a0db9048a42830c1234571c29.zip |
fix #839
-rw-r--r-- | libmproxy/proxy/modes/socks_proxy.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libmproxy/proxy/modes/socks_proxy.py b/libmproxy/proxy/modes/socks_proxy.py index 1eb7db5b..264c734a 100644 --- a/libmproxy/proxy/modes/socks_proxy.py +++ b/libmproxy/proxy/modes/socks_proxy.py @@ -1,6 +1,6 @@ from __future__ import (absolute_import, print_function, division) -from netlib import socks +from netlib import socks, tcp from netlib.exceptions import TcpException from ...exceptions import Socks5ProtocolException @@ -50,7 +50,9 @@ class Socks5Proxy(Layer, ServerConnectionMixin): except (socks.SocksError, TcpException) as e: raise Socks5ProtocolException("SOCKS5 mode failure: %s" % repr(e)) - self.server_conn.address = connect_request.addr + # https://github.com/mitmproxy/mitmproxy/issues/839 + address_bytes = (connect_request.addr.host.encode("idna"), connect_request.addr.port) + self.server_conn.address = tcp.Address(address_bytes, connect_request.addr.use_ipv6) layer = self.ctx.next_layer(self) try: |