diff options
| author | Aldo Cortesi <aldo@nullcube.com> | 2013-03-01 09:05:39 +1300 | 
|---|---|---|
| committer | Aldo Cortesi <aldo@nullcube.com> | 2013-03-01 09:05:39 +1300 | 
| commit | ba674ad5514c5f30315fc688a07fdac634d94dfc (patch) | |
| tree | faf367a64d16bceb5988050a18b75171fdc5bdf2 /test/tservers.py | |
| parent | b077189dd5230b6c440a200d867c70c6ce031b66 (diff) | |
| download | mitmproxy-ba674ad5514c5f30315fc688a07fdac634d94dfc.tar.gz mitmproxy-ba674ad5514c5f30315fc688a07fdac634d94dfc.tar.bz2 mitmproxy-ba674ad5514c5f30315fc688a07fdac634d94dfc.zip  | |
New SNI handling mechanism.
Diffstat (limited to 'test/tservers.py')
| -rw-r--r-- | test/tservers.py | 33 | 
1 files changed, 23 insertions, 10 deletions
diff --git a/test/tservers.py b/test/tservers.py index 998ad6c6..c8bc7100 100644 --- a/test/tservers.py +++ b/test/tservers.py @@ -126,20 +126,21 @@ class HTTPProxTest(ProxTestBase):          """              Returns a connected Pathoc instance.          """ -        p = libpathod.pathoc.Pathoc("localhost", self.proxy.port) +        p = libpathod.pathoc.Pathoc("localhost", self.proxy.port, ssl=self.ssl)          p.connect(connect_to)          return p      def pathod(self, spec):          """ -            Constructs a pathod request, with the appropriate base and proxy. +            Constructs a pathod GET request, with the appropriate base and proxy.          """ -        return hurl.get( -            self.server.urlbase + "/p/" + spec, -            proxy=self.proxies, -            validate_cert=False, -            #debug=hurl.utils.stdout_debug -        ) +        if self.ssl: +            p = self.pathoc(("127.0.0.1", self.server.port)) +            q = "get:'/p/%s'"%spec +        else: +            p = self.pathoc() +            q = "get:'%s/p/%s'"%(self.server.urlbase, spec) +        return p.request(q)  class TResolver: @@ -155,9 +156,13 @@ class TransparentProxTest(ProxTestBase):      @classmethod      def get_proxy_config(cls):          d = ProxTestBase.get_proxy_config() +        if cls.ssl: +            ports = [cls.server.port, cls.server2.port] +        else: +            ports = []          d["transparent_proxy"] = dict(              resolver = TResolver(cls.server.port), -            sslports = [] +            sslports = ports          )          return d @@ -166,12 +171,20 @@ class TransparentProxTest(ProxTestBase):              Constructs a pathod request, with the appropriate base and proxy.          """          r = hurl.get( -            "http://127.0.0.1:%s"%self.proxy.port + "/p/" + spec, +            "%s://127.0.0.1:%s"%(self.scheme, self.proxy.port) + "/p/" + spec,              validate_cert=False,              #debug=hurl.utils.stdout_debug          )          return r +    def pathoc(self, connect= None): +        """ +            Returns a connected Pathoc instance. +        """ +        p = libpathod.pathoc.Pathoc("localhost", self.proxy.port) +        p.connect(connect_to) +        return p +  class ReverseProxTest(ProxTestBase):      ssl = None  | 
