mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
Remove last vestiges of noapi and noweb from pathod
Also hide HTTP2 freeze bug by making explain configurable in the tests
This commit is contained in:
parent
48da24ae7e
commit
375d7c9741
@ -304,9 +304,7 @@ class Pathod(tcp.TCPServer):
|
||||
staticdir=None,
|
||||
anchors=(),
|
||||
sizelimit=None,
|
||||
noweb=False,
|
||||
nocraft=False,
|
||||
noapi=False,
|
||||
nohang=False,
|
||||
timeout=None,
|
||||
logreq=False,
|
||||
@ -328,7 +326,6 @@ class Pathod(tcp.TCPServer):
|
||||
None.
|
||||
sizelimit: Limit size of served data.
|
||||
nocraft: Disable response crafting.
|
||||
noapi: Disable the API.
|
||||
nohang: Disable pauses.
|
||||
"""
|
||||
tcp.TCPServer.__init__(self, addr)
|
||||
@ -337,8 +334,8 @@ class Pathod(tcp.TCPServer):
|
||||
self.staticdir = staticdir
|
||||
self.craftanchor = craftanchor
|
||||
self.sizelimit = sizelimit
|
||||
self.noweb, self.nocraft = noweb, nocraft
|
||||
self.noapi, self.nohang = noapi, nohang
|
||||
self.nocraft = nocraft
|
||||
self.nohang = nohang
|
||||
self.timeout, self.logreq = timeout, logreq
|
||||
self.logresp, self.hexdump = logresp, hexdump
|
||||
self.http2_framedump = http2_framedump
|
||||
@ -404,7 +401,6 @@ class Pathod(tcp.TCPServer):
|
||||
return
|
||||
|
||||
def add_log(self, d):
|
||||
if not self.noapi:
|
||||
with self.loglock:
|
||||
d["id"] = self.logid
|
||||
self.log.insert(0, d)
|
||||
@ -469,9 +465,7 @@ def main(args): # pragma: no cover
|
||||
staticdir=args.staticdir,
|
||||
anchors=args.anchors,
|
||||
sizelimit=args.sizelimit,
|
||||
noweb=args.noweb,
|
||||
nocraft=args.nocraft,
|
||||
noapi=args.noapi,
|
||||
nohang=args.nohang,
|
||||
timeout=args.timeout,
|
||||
logreq=args.logreq,
|
||||
|
@ -74,18 +74,10 @@ def args_pathod(argv, stdout_=sys.stdout, stderr_=sys.stderr):
|
||||
default=None,
|
||||
type=str,
|
||||
help='Size limit of served responses. Understands size suffixes, i.e. 100k.')
|
||||
parser.add_argument(
|
||||
"--noapi", dest='noapi', default=False, action="store_true",
|
||||
help='Disable API.'
|
||||
)
|
||||
parser.add_argument(
|
||||
"--nohang", dest='nohang', default=False, action="store_true",
|
||||
help='Disable pauses during crafted response generation.'
|
||||
)
|
||||
parser.add_argument(
|
||||
"--noweb", dest='noweb', default=False, action="store_true",
|
||||
help='Disable both web interface and API.'
|
||||
)
|
||||
parser.add_argument(
|
||||
"--nocraft",
|
||||
dest='nocraft',
|
||||
|
@ -228,6 +228,7 @@ class TestDaemon(PathocTestDaemon):
|
||||
|
||||
class TestDaemonHTTP2(PathocTestDaemon):
|
||||
ssl = True
|
||||
explain = False
|
||||
|
||||
if tcp.HAS_ALPN:
|
||||
|
||||
|
@ -23,18 +23,10 @@ class TestPathod(object):
|
||||
assert len(p.get_log()) <= p.LOGBUF
|
||||
|
||||
|
||||
class TestNoWeb(tutils.DaemonTests):
|
||||
noweb = True
|
||||
|
||||
def test_noweb(self):
|
||||
assert self.get("200:da").status_code == 200
|
||||
assert self.getpath("/").status_code == 800
|
||||
|
||||
|
||||
class TestTimeout(tutils.DaemonTests):
|
||||
timeout = 0.01
|
||||
|
||||
def test_noweb(self):
|
||||
def test_timeout(self):
|
||||
# FIXME: Add float values to spec language, reduce test timeout to
|
||||
# increase test performance
|
||||
# This is a bodge - we have some platform difference that causes
|
||||
@ -261,8 +253,6 @@ class TestDaemonSSL(CommonTests):
|
||||
|
||||
class TestHTTP2(tutils.DaemonTests):
|
||||
ssl = True
|
||||
noweb = True
|
||||
noapi = True
|
||||
nohang = True
|
||||
|
||||
if tcp.HAS_ALPN:
|
||||
|
@ -24,14 +24,13 @@ def treader(bytes):
|
||||
|
||||
|
||||
class DaemonTests(object):
|
||||
noweb = False
|
||||
noapi = False
|
||||
nohang = False
|
||||
ssl = False
|
||||
timeout = None
|
||||
hexdump = False
|
||||
ssloptions = None
|
||||
nocraft = False
|
||||
explain = True
|
||||
|
||||
@classmethod
|
||||
def setup_class(cls):
|
||||
@ -47,15 +46,13 @@ class DaemonTests(object):
|
||||
ssl=cls.ssl,
|
||||
ssloptions=so,
|
||||
sizelimit=1 * 1024 * 1024,
|
||||
noweb=cls.noweb,
|
||||
noapi=cls.noapi,
|
||||
nohang=cls.nohang,
|
||||
timeout=cls.timeout,
|
||||
hexdump=cls.hexdump,
|
||||
nocraft=cls.nocraft,
|
||||
logreq=True,
|
||||
logresp=True,
|
||||
explain=True
|
||||
explain=cls.explain
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@ -65,7 +62,6 @@ class DaemonTests(object):
|
||||
|
||||
def teardown(self):
|
||||
self.d.wait_for_silence()
|
||||
if not (self.noweb or self.noapi):
|
||||
self.d.clear_log()
|
||||
|
||||
def _getpath(self, path, params=None):
|
||||
|
Loading…
Reference in New Issue
Block a user