mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
Merge pull request #2881 from cortesi/refreshopt
option refresh_server_playback -> server_replay_refresh
This commit is contained in:
commit
da4c1ee625
@ -132,13 +132,13 @@ class ServerPlayback:
|
||||
if rflow:
|
||||
response = rflow.response.copy()
|
||||
response.is_replay = True
|
||||
if ctx.options.refresh_server_playback:
|
||||
if ctx.options.server_replay_refresh:
|
||||
response.refresh()
|
||||
f.response = response
|
||||
if not self.flowmap:
|
||||
self.final_flow = f
|
||||
self.stop = True
|
||||
elif ctx.options.replay_kill_extra:
|
||||
elif ctx.options.server_replay_kill_extra:
|
||||
ctx.log.warn(
|
||||
"server_playback: killed non-replay request {}".format(
|
||||
f.request.url
|
||||
|
@ -63,9 +63,9 @@ class Options(optmanager.OptManager):
|
||||
onboarding_port = None # type: int
|
||||
proxyauth = None # type: Optional[str]
|
||||
rawtcp = None # type: bool
|
||||
refresh_server_playback = None # type: bool
|
||||
server_replay_refresh = None # type: bool
|
||||
replacements = None # type: Sequence[str]
|
||||
replay_kill_extra = None # type: bool
|
||||
server_replay_kill_extra = None # type: bool
|
||||
rfile = None # type: Optional[str]
|
||||
save_stream_file = None # type: Optional[str]
|
||||
save_stream_filter = None # type: Optional[str]
|
||||
@ -137,7 +137,7 @@ class Options(optmanager.OptManager):
|
||||
"Replay client requests from a saved file."
|
||||
)
|
||||
self.add_option(
|
||||
"replay_kill_extra", bool, False,
|
||||
"server_replay_kill_extra", bool, False,
|
||||
"Kill extra requests during replay."
|
||||
)
|
||||
self.add_option(
|
||||
@ -160,7 +160,7 @@ class Options(optmanager.OptManager):
|
||||
"""
|
||||
)
|
||||
self.add_option(
|
||||
"refresh_server_playback", bool, True,
|
||||
"server_replay_refresh", bool, True,
|
||||
"""
|
||||
Refresh server replay responses by adjusting date, expires and
|
||||
last-modified headers, as well as adjusting cookie expiration.
|
||||
|
@ -87,7 +87,7 @@ def common_options(parser, opts):
|
||||
# Server replay
|
||||
group = parser.add_argument_group("Server Replay")
|
||||
opts.make_parser(group, "server_replay", metavar="PATH", short="S")
|
||||
opts.make_parser(group, "replay_kill_extra")
|
||||
opts.make_parser(group, "server_replay_kill_extra")
|
||||
opts.make_parser(group, "server_replay_nopop")
|
||||
|
||||
# Replacements
|
||||
|
@ -213,9 +213,9 @@ class StatusBar(urwid.WidgetWrap):
|
||||
opts.append("anticomp")
|
||||
if self.master.options.showhost:
|
||||
opts.append("showhost")
|
||||
if not self.master.options.refresh_server_playback:
|
||||
if not self.master.options.server_replay_refresh:
|
||||
opts.append("norefresh")
|
||||
if self.master.options.replay_kill_extra:
|
||||
if self.master.options.server_replay_kill_extra:
|
||||
opts.append("killextra")
|
||||
if not self.master.options.upstream_cert:
|
||||
opts.append("no-upstream-cert")
|
||||
|
@ -331,7 +331,7 @@ def test_server_playback_full():
|
||||
with taddons.context() as tctx:
|
||||
tctx.configure(
|
||||
s,
|
||||
refresh_server_playback = True,
|
||||
server_replay_refresh = True,
|
||||
)
|
||||
|
||||
f = tflow.tflow()
|
||||
@ -363,8 +363,8 @@ def test_server_playback_kill():
|
||||
with taddons.context() as tctx:
|
||||
tctx.configure(
|
||||
s,
|
||||
refresh_server_playback = True,
|
||||
replay_kill_extra=True
|
||||
server_replay_refresh = True,
|
||||
server_replay_kill_extra=True
|
||||
)
|
||||
|
||||
f = tflow.tflow()
|
||||
|
@ -8,7 +8,7 @@ from ... import tservers
|
||||
|
||||
|
||||
def test_options():
|
||||
assert options.Options(replay_kill_extra=True)
|
||||
assert options.Options(server_replay_kill_extra=True)
|
||||
|
||||
|
||||
class TestMaster(tservers.MasterTest):
|
||||
|
@ -16,8 +16,8 @@ def test_statusbar(monkeypatch):
|
||||
anticache=True,
|
||||
anticomp=True,
|
||||
showhost=True,
|
||||
refresh_server_playback=False,
|
||||
replay_kill_extra=True,
|
||||
server_replay_refresh=False,
|
||||
server_replay_kill_extra=True,
|
||||
upstream_cert=False,
|
||||
stream_large_bodies="3m",
|
||||
mode="transparent",
|
||||
|
Loading…
Reference in New Issue
Block a user