diff options
author | Maximilian Hils <git@maximilianhils.com> | 2017-02-03 18:56:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-03 18:56:56 +0100 |
commit | bbdb7300fd7a513f13a3ed52124265798e646c91 (patch) | |
tree | f6a5f89d664a993b3c53ec4b1d9a0ece44a9c731 /test | |
parent | 85e39b86bb582a1065741e28a88e18a6fb146281 (diff) | |
parent | bcaaa2f40b0f5decdca8d277428cd4babf38c0d1 (diff) | |
download | mitmproxy-bbdb7300fd7a513f13a3ed52124265798e646c91.tar.gz mitmproxy-bbdb7300fd7a513f13a3ed52124265798e646c91.tar.bz2 mitmproxy-bbdb7300fd7a513f13a3ed52124265798e646c91.zip |
Merge pull request #1983 from Kriechi/coverage++
coverage++
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/test_server.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/mitmproxy/test_server.py b/test/mitmproxy/test_server.py index 272fc0e0..86fc6ba0 100644 --- a/test/mitmproxy/test_server.py +++ b/test/mitmproxy/test_server.py @@ -503,6 +503,7 @@ class TestSocks5(tservers.SocksModeTest): f = p.request("get:/p/200") assert f.status_code == 502 assert b"SOCKS5 mode failure" in f.content + assert b"Invalid SOCKS version. Expected 0x05, got 0x47" in f.content def test_no_connect(self): """ @@ -526,6 +527,27 @@ class TestSocks5(tservers.SocksModeTest): f = p.request("get:/p/200") # the request doesn't matter, error response from handshake will be read anyway. assert f.status_code == 502 assert b"SOCKS5 mode failure" in f.content + assert b"mitmproxy only supports SOCKS5 CONNECT" in f.content + + def test_with_authentication(self): + p = self.pathoc() + with p.connect(): + socks.ClientGreeting( + socks.VERSION.SOCKS5, + [socks.METHOD.USERNAME_PASSWORD] + ).to_file(p.wfile) + socks.Message( + socks.VERSION.SOCKS5, + socks.CMD.BIND, + socks.ATYP.DOMAINNAME, + ("example.com", 8080) + ).to_file(p.wfile) + + p.wfile.flush() + f = p.request("get:/p/200") # the request doesn't matter, error response from handshake will be read anyway. + assert f.status_code == 502 + assert b"SOCKS5 mode failure" in f.content + assert b"mitmproxy only supports SOCKS without authentication" in f.content class TestSocks5SSL(tservers.SocksModeTest): |