aboutsummaryrefslogtreecommitdiffstats
path: root/test/tservers.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/tservers.py')
-rw-r--r--test/tservers.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/test/tservers.py b/test/tservers.py
index 12692369..d405e745 100644
--- a/test/tservers.py
+++ b/test/tservers.py
@@ -1,6 +1,5 @@
import threading, Queue
import flask
-import human_curl as hurl
import libpathod.test, libpathod.pathoc
from libmproxy import proxy, flow, controller
import tutils
@@ -205,14 +204,23 @@ class ReverseProxTest(ProxTestBase):
)
return d
- def pathod(self, spec):
+ def pathoc(self, sni=None):
"""
- Constructs a pathod request, with the appropriate base and proxy.
+ Returns a connected Pathoc instance.
"""
- r = hurl.get(
- "http://127.0.0.1:%s"%self.proxy.port + "/p/" + spec,
- validate_cert=False,
- #debug=hurl.utils.stdout_debug
- )
- return r
+ p = libpathod.pathoc.Pathoc("localhost", self.proxy.port, ssl=self.ssl, sni=sni)
+ p.connect()
+ return p
+
+ def pathod(self, spec, sni=None):
+ """
+ Constructs a pathod GET request, with the appropriate base and proxy.
+ """
+ if self.ssl:
+ p = self.pathoc(sni=sni)
+ q = "get:'/p/%s'"%spec
+ else:
+ p = self.pathoc()
+ q = "get:'/p/%s'"%spec
+ return p.request(q)