aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_server.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-08-28 01:51:13 +0200
committerMaximilian Hils <git@maximilianhils.com>2015-08-28 01:51:13 +0200
commit1cc48345e13917aadc1e0fd93d6011139e78e3d9 (patch)
tree9758b20f95587104807fc74e545e35ec9a9cdef3 /test/test_server.py
parenta86491eeed13c7889356e5102312f52bd86c3c66 (diff)
downloadmitmproxy-1cc48345e13917aadc1e0fd93d6011139e78e3d9.tar.gz
mitmproxy-1cc48345e13917aadc1e0fd93d6011139e78e3d9.tar.bz2
mitmproxy-1cc48345e13917aadc1e0fd93d6011139e78e3d9.zip
clean up config/cmdline, fix bugs, remove cruft
Diffstat (limited to 'test/test_server.py')
-rw-r--r--test/test_server.py53
1 files changed, 2 insertions, 51 deletions
diff --git a/test/test_server.py b/test/test_server.py
index e9c40d1a..1216a349 100644
--- a/test/test_server.py
+++ b/test/test_server.py
@@ -464,60 +464,11 @@ class TestSocks5(tservers.SocksModeTest):
assert "SOCKS5 mode failure" in f.content
-class TestSpoof(tservers.SpoofModeTest):
- def test_http(self):
- alist = (
- ("localhost", self.server.port),
- ("127.0.0.1", self.server.port)
- )
- for a in alist:
- self.server.clear_log()
- p = self.pathoc()
- f = p.request("get:/p/304:h'Host'='%s:%s'" % a)
- assert self.server.last_log()
- assert f.status_code == 304
- l = self.master.state.view[-1]
- assert l.server_conn.address
- assert l.server_conn.address.host == a[0]
- assert l.server_conn.address.port == a[1]
-
- def test_http_without_host(self):
- p = self.pathoc()
- f = p.request("get:/p/304:r")
- assert f.status_code == 400
-
-
-class TestSSLSpoof(tservers.SSLSpoofModeTest):
- def test_https(self):
- alist = (
- ("localhost", self.server.port),
- ("127.0.0.1", self.server.port)
- )
- for a in alist:
- self.server.clear_log()
- self.config.mode.sslport = a[1]
- p = self.pathoc(sni=a[0])
- f = p.request("get:/p/304")
- assert self.server.last_log()
- assert f.status_code == 304
- l = self.master.state.view[-1]
- assert l.server_conn.address
- assert l.server_conn.address.host == a[0]
- assert l.server_conn.address.port == a[1]
-
- def test_https_without_sni(self):
- a = ("localhost", self.server.port)
- self.config.mode.sslport = a[1]
- p = self.pathoc(sni=None)
- f = p.request("get:/p/304")
- assert f.status_code == 400
-
-
class TestHttps2Http(tservers.ReverseProxTest):
@classmethod
def get_proxy_config(cls):
d = super(TestHttps2Http, cls).get_proxy_config()
- d["upstream_server"][0] = True
+ d["upstream_server"] = ("https2http", d["upstream_server"][1])
return d
def pathoc(self, ssl, sni=None):
@@ -541,7 +492,7 @@ class TestHttps2Http(tservers.ReverseProxTest):
def test_http(self):
p = self.pathoc(ssl=False)
- assert p.request("get:'/p/200'").status_code == 400
+ assert p.request("get:'/p/200'").status_code == 502
class TestTransparent(tservers.TransparentProxTest, CommonMixin, TcpMixin):