From a34a4831843d5745e200c1df58672973a57aebb0 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 2 Mar 2014 15:14:22 +1300 Subject: Adapt for new pathod and netlib APIs. --- libmproxy/console/flowview.py | 1 - libmproxy/proxy.py | 4 ++-- test/test_protocol_http.py | 3 --- test/test_server.py | 13 ++++++++++--- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/libmproxy/console/flowview.py b/libmproxy/console/flowview.py index f95f2ded..3486f57e 100644 --- a/libmproxy/console/flowview.py +++ b/libmproxy/console/flowview.py @@ -346,7 +346,6 @@ class FlowView(common.WWrap): wrapped, wrapped_message = self.search_wrapped_around(last_find_line, last_search_index, backwards) if wrapped: - print(wrapped, wrapped_message) return wrapped_message def search_get_start(self, search_string): diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index b6480822..0203ba86 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -48,7 +48,7 @@ class ProxyConfig: self.forward_proxy = forward_proxy self.transparent_proxy = transparent_proxy self.authenticator = authenticator - self.certstore = certutils.CertStore() + self.certstore = certutils.CertStore(cacert) class ClientConnection(tcp.BaseHandler, stateobject.SimpleStateObject): @@ -422,7 +422,7 @@ class ConnectionHandler: host = upstream_cert.cn.decode("utf8").encode("idna") sans = upstream_cert.altnames - ret = self.config.certstore.get_cert(host, sans, self.config.cacert) + ret = self.config.certstore.get_cert(host, sans) if not ret: raise ProxyError(502, "Unable to generate dummy cert.") return ret diff --git a/test/test_protocol_http.py b/test/test_protocol_http.py index d2ba24de..18aad3b6 100644 --- a/test/test_protocol_http.py +++ b/test/test_protocol_http.py @@ -88,7 +88,6 @@ class TestHTTPResponse: class TestInvalidRequests(tservers.HTTPProxTest): ssl = True - def test_double_connect(self): p = self.pathoc() r = p.request("connect:'%s:%s'" % ("127.0.0.1", self.server2.port)) @@ -117,9 +116,7 @@ class TestProxyChaining(tservers.HTTPChainProxyTest): class TestProxyChainingSSL(tservers.HTTPChainProxyTest): ssl = True - def test_simple(self): - p = self.pathoc() req = p.request("get:'/p/418:b\"content\"'") assert req.content == "content" diff --git a/test/test_server.py b/test/test_server.py index 2f9e6728..a86c095c 100644 --- a/test/test_server.py +++ b/test/test_server.py @@ -206,13 +206,20 @@ class TestHTTPSCertfile(tservers.HTTPProxTest, CommonMixin): def test_certfile(self): assert self.pathod("304") -class TestHTTPSNoCommonName(tservers.HTTPProxTest, CommonMixin): + +class TestHTTPSNoCommonName(tservers.HTTPProxTest): """ Test what happens if we get a cert without common name back. """ ssl = True - ssloptions=pathod.SSLOptions(certfile=tutils.test_data.path("data/no_common_name.pem"), - keyfile=tutils.test_data.path("data/no_common_name.pem")) + ssloptions=pathod.SSLOptions( + certfile = tutils.test_data.path("data/no_common_name.pem"), + cacert = tutils.test_data.path("data/no_common_name.pem"), + ) + def test_http(self): + f = self.pathod("202") + assert f.sslinfo.certchain[0].get_subject().CN == "127.0.0.1" + class TestReverse(tservers.ReverseProxTest, CommonMixin): reverse = True -- cgit v1.2.3