aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-10-16 23:50:25 -0700
committerGitHub <noreply@github.com>2016-10-16 23:50:25 -0700
commit7047531a3c639f331a5fbca2ab734846f6629f8d (patch)
tree1b8f333449e5ed2c296de160ac02c70edba0404c
parent02d3d618204bce2bc0ed088a556a94a8479dcf31 (diff)
parent758860531a5602a3280fc3669aa7dfbc327f1c56 (diff)
downloadmitmproxy-7047531a3c639f331a5fbca2ab734846f6629f8d.tar.gz
mitmproxy-7047531a3c639f331a5fbca2ab734846f6629f8d.tar.bz2
mitmproxy-7047531a3c639f331a5fbca2ab734846f6629f8d.zip
Merge pull request #1619 from mhils/fix-socks-tls
Fix SOCKS5 mode with TLS
-rw-r--r--mitmproxy/proxy/modes/socks_proxy.py4
-rw-r--r--test/mitmproxy/test_server.py12
2 files changed, 13 insertions, 3 deletions
diff --git a/mitmproxy/proxy/modes/socks_proxy.py b/mitmproxy/proxy/modes/socks_proxy.py
index e9e684b3..3d8c9ee8 100644
--- a/mitmproxy/proxy/modes/socks_proxy.py
+++ b/mitmproxy/proxy/modes/socks_proxy.py
@@ -53,9 +53,7 @@ class Socks5Proxy(protocol.Layer, protocol.ServerConnectionMixin):
except (socks.SocksError, netlib.exceptions.TcpException) as e:
raise exceptions.Socks5ProtocolException("SOCKS5 mode failure: %s" % repr(e))
- # 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)
+ self.server_conn.address = connect_request.addr
layer = self.ctx.next_layer(self)
try:
diff --git a/test/mitmproxy/test_server.py b/test/mitmproxy/test_server.py
index 923d8ccf..a175d193 100644
--- a/test/mitmproxy/test_server.py
+++ b/test/mitmproxy/test_server.py
@@ -536,6 +536,18 @@ class TestSocks5(tservers.SocksModeTest):
assert b"SOCKS5 mode failure" in f.content
+class TestSocks5SSL(tservers.SocksModeTest):
+ ssl = True
+
+ def test_simple(self):
+ p = self.pathoc_raw()
+ with p.connect():
+ p.socks_connect(("localhost", self.server.port))
+ p.convert_to_ssl()
+ f = p.request("get:/p/200")
+ assert f.status_code == 200
+
+
class TestHttps2Http(tservers.ReverseProxyTest):
@classmethod