mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-12-02 12:01:17 +00:00
Use injection to test a corner case in pathod daemon.
This commit is contained in:
parent
8ec44c6277
commit
5577d85ce6
@ -1,5 +1,5 @@
|
|||||||
import requests
|
import requests
|
||||||
from libpathod import pathod, test, version
|
from libpathod import pathod, test, version, pathoc
|
||||||
from netlib import tcp
|
from netlib import tcp
|
||||||
import tutils
|
import tutils
|
||||||
|
|
||||||
@ -64,6 +64,17 @@ class _DaemonTests:
|
|||||||
scheme = "https" if self.SSL else "http"
|
scheme = "https" if self.SSL else "http"
|
||||||
return requests.get("%s://localhost:%s/p/%s"%(scheme, self.d.port, spec), verify=False)
|
return requests.get("%s://localhost:%s/p/%s"%(scheme, self.d.port, spec), verify=False)
|
||||||
|
|
||||||
|
def pathoc(self, spec):
|
||||||
|
c = pathoc.Pathoc("localhost", self.d.port)
|
||||||
|
c.connect()
|
||||||
|
if self.SSL:
|
||||||
|
c.convert_to_ssl()
|
||||||
|
return c.request(spec)
|
||||||
|
|
||||||
|
def test_preline(self):
|
||||||
|
v = self.pathoc(r"get:'/p/200':i0,'\r\n'")
|
||||||
|
assert v[1] == 200
|
||||||
|
|
||||||
def test_info(self):
|
def test_info(self):
|
||||||
assert tuple(self.d.info()["version"]) == version.IVERSION
|
assert tuple(self.d.info()["version"]) == version.IVERSION
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user