mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
options.kill -> options.replay_kill_extra
This commit is contained in:
parent
01cdaf4133
commit
b0213a2c0e
@ -101,7 +101,6 @@ class ServerPlayback(object):
|
|||||||
# prefixed with serverplayback_ where appropriate, and playback_ where
|
# prefixed with serverplayback_ where appropriate, and playback_ where
|
||||||
# they're shared with client playback.
|
# they're shared with client playback.
|
||||||
#
|
#
|
||||||
# options.kill
|
|
||||||
# options.rheaders,
|
# options.rheaders,
|
||||||
# options.nopop,
|
# options.nopop,
|
||||||
# options.replay_ignore_params,
|
# options.replay_ignore_params,
|
||||||
@ -125,7 +124,7 @@ class ServerPlayback(object):
|
|||||||
if not self.flowmap and not self.options.keepserving:
|
if not self.flowmap and not self.options.keepserving:
|
||||||
self.final_flow = f
|
self.final_flow = f
|
||||||
self.stop = True
|
self.stop = True
|
||||||
elif self.options.kill:
|
elif self.options.replay_kill_extra:
|
||||||
ctx.log.warn(
|
ctx.log.warn(
|
||||||
"server_playback: killed non-replay request {}".format(
|
"server_playback: killed non-replay request {}".format(
|
||||||
f.request.url
|
f.request.url
|
||||||
|
@ -218,7 +218,7 @@ def get_common_options(args):
|
|||||||
anticache=args.anticache,
|
anticache=args.anticache,
|
||||||
anticomp=args.anticomp,
|
anticomp=args.anticomp,
|
||||||
client_replay=args.client_replay,
|
client_replay=args.client_replay,
|
||||||
kill=args.kill,
|
replay_kill_extra=args.replay_kill_extra,
|
||||||
no_server=args.no_server,
|
no_server=args.no_server,
|
||||||
refresh_server_playback=not args.norefresh,
|
refresh_server_playback=not args.norefresh,
|
||||||
rheaders=args.rheaders,
|
rheaders=args.rheaders,
|
||||||
@ -594,8 +594,8 @@ def server_replay(parser):
|
|||||||
help="Replay server responses from a saved file."
|
help="Replay server responses from a saved file."
|
||||||
)
|
)
|
||||||
group.add_argument(
|
group.add_argument(
|
||||||
"-k", "--kill",
|
"-k", "--replay-kill-extra",
|
||||||
action="store_true", dest="kill", default=False,
|
action="store_true", dest="replay_kill_extra", default=False,
|
||||||
help="Kill extra requests during replay."
|
help="Kill extra requests during replay."
|
||||||
)
|
)
|
||||||
group.add_argument(
|
group.add_argument(
|
||||||
|
@ -148,7 +148,7 @@ class ConnectionItem(urwid.WidgetWrap):
|
|||||||
if k == "a":
|
if k == "a":
|
||||||
self.master.start_server_playback(
|
self.master.start_server_playback(
|
||||||
[i.copy() for i in self.master.state.view],
|
[i.copy() for i in self.master.state.view],
|
||||||
self.master.options.kill, self.master.options.rheaders,
|
self.master.options.replay_kill_extra, self.master.options.rheaders,
|
||||||
False, self.master.options.nopop,
|
False, self.master.options.nopop,
|
||||||
self.master.options.replay_ignore_params,
|
self.master.options.replay_ignore_params,
|
||||||
self.master.options.replay_ignore_content,
|
self.master.options.replay_ignore_content,
|
||||||
@ -158,7 +158,7 @@ class ConnectionItem(urwid.WidgetWrap):
|
|||||||
elif k == "t":
|
elif k == "t":
|
||||||
self.master.start_server_playback(
|
self.master.start_server_playback(
|
||||||
[self.flow.copy()],
|
[self.flow.copy()],
|
||||||
self.master.options.kill, self.master.options.rheaders,
|
self.master.options.replay_kill_extra, self.master.options.rheaders,
|
||||||
False, self.master.options.nopop,
|
False, self.master.options.nopop,
|
||||||
self.master.options.replay_ignore_params,
|
self.master.options.replay_ignore_params,
|
||||||
self.master.options.replay_ignore_content,
|
self.master.options.replay_ignore_content,
|
||||||
|
@ -114,7 +114,7 @@ class Options(urwid.WidgetWrap):
|
|||||||
select.Option(
|
select.Option(
|
||||||
"Kill Extra",
|
"Kill Extra",
|
||||||
"x",
|
"x",
|
||||||
lambda: master.options.kill,
|
lambda: master.options.replay_kill_extra,
|
||||||
master.options.toggler("kill")
|
master.options.toggler("kill")
|
||||||
),
|
),
|
||||||
select.Option(
|
select.Option(
|
||||||
@ -165,7 +165,7 @@ class Options(urwid.WidgetWrap):
|
|||||||
anticomp = False,
|
anticomp = False,
|
||||||
ignore_hosts = (),
|
ignore_hosts = (),
|
||||||
tcp_hosts = (),
|
tcp_hosts = (),
|
||||||
kill = False,
|
replay_kill_extra = False,
|
||||||
no_upstream_cert = False,
|
no_upstream_cert = False,
|
||||||
refresh_server_playback = True,
|
refresh_server_playback = True,
|
||||||
replacements = [],
|
replacements = [],
|
||||||
|
@ -191,7 +191,7 @@ class StatusBar(urwid.WidgetWrap):
|
|||||||
opts.append("showhost")
|
opts.append("showhost")
|
||||||
if not self.master.options.refresh_server_playback:
|
if not self.master.options.refresh_server_playback:
|
||||||
opts.append("norefresh")
|
opts.append("norefresh")
|
||||||
if self.master.options.kill:
|
if self.master.options.replay_kill_extra:
|
||||||
opts.append("killextra")
|
opts.append("killextra")
|
||||||
if self.master.options.no_upstream_cert:
|
if self.master.options.no_upstream_cert:
|
||||||
opts.append("no-upstream-cert")
|
opts.append("no-upstream-cert")
|
||||||
|
@ -30,7 +30,7 @@ class Options(optmanager.OptManager):
|
|||||||
anticache=False, # type: bool
|
anticache=False, # type: bool
|
||||||
anticomp=False, # type: bool
|
anticomp=False, # type: bool
|
||||||
client_replay=None, # type: Optional[str]
|
client_replay=None, # type: Optional[str]
|
||||||
kill=False, # type: bool
|
replay_kill_extra=False, # type: bool
|
||||||
keepserving=True, # type: bool
|
keepserving=True, # type: bool
|
||||||
no_server=False, # type: bool
|
no_server=False, # type: bool
|
||||||
nopop=False, # type: bool
|
nopop=False, # type: bool
|
||||||
@ -89,7 +89,7 @@ class Options(optmanager.OptManager):
|
|||||||
self.anticomp = anticomp
|
self.anticomp = anticomp
|
||||||
self.client_replay = client_replay
|
self.client_replay = client_replay
|
||||||
self.keepserving = keepserving
|
self.keepserving = keepserving
|
||||||
self.kill = kill
|
self.replay_kill_extra = replay_kill_extra
|
||||||
self.no_server = no_server
|
self.no_server = no_server
|
||||||
self.nopop = nopop
|
self.nopop = nopop
|
||||||
self.refresh_server_playback = refresh_server_playback
|
self.refresh_server_playback = refresh_server_playback
|
||||||
|
@ -270,7 +270,7 @@ class TestServerPlayback:
|
|||||||
def test_server_playback_kill(self):
|
def test_server_playback_kill(self):
|
||||||
state = flow.State()
|
state = flow.State()
|
||||||
s = serverplayback.ServerPlayback()
|
s = serverplayback.ServerPlayback()
|
||||||
o = options.Options(refresh_server_playback = True, kill=True)
|
o = options.Options(refresh_server_playback = True, replay_kill_extra=True)
|
||||||
m = mastertest.RecordingMaster(o, None, state)
|
m = mastertest.RecordingMaster(o, None, state)
|
||||||
m.addons.add(o, s)
|
m.addons.add(o, s)
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ def test_format_keyvals():
|
|||||||
|
|
||||||
|
|
||||||
def test_options():
|
def test_options():
|
||||||
assert console.master.Options(kill=True)
|
assert console.master.Options(replay_kill_extra=True)
|
||||||
|
|
||||||
|
|
||||||
class TestMaster(mastertest.MasterTest):
|
class TestMaster(mastertest.MasterTest):
|
||||||
|
@ -49,14 +49,14 @@ class TestDumpMaster(mastertest.MasterTest):
|
|||||||
assert "error" in o.tfile.getvalue()
|
assert "error" in o.tfile.getvalue()
|
||||||
|
|
||||||
def test_replay(self):
|
def test_replay(self):
|
||||||
o = dump.Options(server_replay=["nonexistent"], kill=True)
|
o = dump.Options(server_replay=["nonexistent"], replay_kill_extra=True)
|
||||||
tutils.raises(exceptions.OptionsError, dump.DumpMaster, None, o)
|
tutils.raises(exceptions.OptionsError, dump.DumpMaster, None, o)
|
||||||
|
|
||||||
with tutils.tmpdir() as t:
|
with tutils.tmpdir() as t:
|
||||||
p = os.path.join(t, "rep")
|
p = os.path.join(t, "rep")
|
||||||
self.flowfile(p)
|
self.flowfile(p)
|
||||||
|
|
||||||
o = dump.Options(server_replay=[p], kill=True)
|
o = dump.Options(server_replay=[p], replay_kill_extra=True)
|
||||||
o.verbosity = 0
|
o.verbosity = 0
|
||||||
o.flow_detail = 0
|
o.flow_detail = 0
|
||||||
m = dump.DumpMaster(None, o)
|
m = dump.DumpMaster(None, o)
|
||||||
@ -64,13 +64,13 @@ class TestDumpMaster(mastertest.MasterTest):
|
|||||||
self.cycle(m, b"content")
|
self.cycle(m, b"content")
|
||||||
self.cycle(m, b"content")
|
self.cycle(m, b"content")
|
||||||
|
|
||||||
o = dump.Options(server_replay=[p], kill=False)
|
o = dump.Options(server_replay=[p], replay_kill_extra=False)
|
||||||
o.verbosity = 0
|
o.verbosity = 0
|
||||||
o.flow_detail = 0
|
o.flow_detail = 0
|
||||||
m = dump.DumpMaster(None, o)
|
m = dump.DumpMaster(None, o)
|
||||||
self.cycle(m, b"nonexistent")
|
self.cycle(m, b"nonexistent")
|
||||||
|
|
||||||
o = dump.Options(client_replay=[p], kill=False)
|
o = dump.Options(client_replay=[p], replay_kill_extra=False)
|
||||||
o.verbosity = 0
|
o.verbosity = 0
|
||||||
o.flow_detail = 0
|
o.flow_detail = 0
|
||||||
m = dump.DumpMaster(None, o)
|
m = dump.DumpMaster(None, o)
|
||||||
|
Loading…
Reference in New Issue
Block a user