Merge pull request #2881 from cortesi/refreshopt

option refresh_server_playback -> server_replay_refresh
This commit is contained in:
Maximilian Hils 2018-02-19 22:52:19 +01:00 committed by GitHub
commit da4c1ee625
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 15 deletions

View File

@ -132,13 +132,13 @@ class ServerPlayback:
if rflow: if rflow:
response = rflow.response.copy() response = rflow.response.copy()
response.is_replay = True response.is_replay = True
if ctx.options.refresh_server_playback: if ctx.options.server_replay_refresh:
response.refresh() response.refresh()
f.response = response f.response = response
if not self.flowmap: if not self.flowmap:
self.final_flow = f self.final_flow = f
self.stop = True self.stop = True
elif ctx.options.replay_kill_extra: elif ctx.options.server_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

View File

@ -63,9 +63,9 @@ class Options(optmanager.OptManager):
onboarding_port = None # type: int onboarding_port = None # type: int
proxyauth = None # type: Optional[str] proxyauth = None # type: Optional[str]
rawtcp = None # type: bool rawtcp = None # type: bool
refresh_server_playback = None # type: bool server_replay_refresh = None # type: bool
replacements = None # type: Sequence[str] replacements = None # type: Sequence[str]
replay_kill_extra = None # type: bool server_replay_kill_extra = None # type: bool
rfile = None # type: Optional[str] rfile = None # type: Optional[str]
save_stream_file = None # type: Optional[str] save_stream_file = None # type: Optional[str]
save_stream_filter = 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." "Replay client requests from a saved file."
) )
self.add_option( self.add_option(
"replay_kill_extra", bool, False, "server_replay_kill_extra", bool, False,
"Kill extra requests during replay." "Kill extra requests during replay."
) )
self.add_option( self.add_option(
@ -160,7 +160,7 @@ class Options(optmanager.OptManager):
""" """
) )
self.add_option( self.add_option(
"refresh_server_playback", bool, True, "server_replay_refresh", bool, True,
""" """
Refresh server replay responses by adjusting date, expires and Refresh server replay responses by adjusting date, expires and
last-modified headers, as well as adjusting cookie expiration. last-modified headers, as well as adjusting cookie expiration.

View File

@ -87,7 +87,7 @@ def common_options(parser, opts):
# Server replay # Server replay
group = parser.add_argument_group("Server Replay") group = parser.add_argument_group("Server Replay")
opts.make_parser(group, "server_replay", metavar="PATH", short="S") 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") opts.make_parser(group, "server_replay_nopop")
# Replacements # Replacements

View File

@ -213,9 +213,9 @@ class StatusBar(urwid.WidgetWrap):
opts.append("anticomp") opts.append("anticomp")
if self.master.options.showhost: if self.master.options.showhost:
opts.append("showhost") opts.append("showhost")
if not self.master.options.refresh_server_playback: if not self.master.options.server_replay_refresh:
opts.append("norefresh") opts.append("norefresh")
if self.master.options.replay_kill_extra: if self.master.options.server_replay_kill_extra:
opts.append("killextra") opts.append("killextra")
if not self.master.options.upstream_cert: if not self.master.options.upstream_cert:
opts.append("no-upstream-cert") opts.append("no-upstream-cert")

View File

@ -331,7 +331,7 @@ def test_server_playback_full():
with taddons.context() as tctx: with taddons.context() as tctx:
tctx.configure( tctx.configure(
s, s,
refresh_server_playback = True, server_replay_refresh = True,
) )
f = tflow.tflow() f = tflow.tflow()
@ -363,8 +363,8 @@ def test_server_playback_kill():
with taddons.context() as tctx: with taddons.context() as tctx:
tctx.configure( tctx.configure(
s, s,
refresh_server_playback = True, server_replay_refresh = True,
replay_kill_extra=True server_replay_kill_extra=True
) )
f = tflow.tflow() f = tflow.tflow()

View File

@ -8,7 +8,7 @@ from ... import tservers
def test_options(): def test_options():
assert options.Options(replay_kill_extra=True) assert options.Options(server_replay_kill_extra=True)
class TestMaster(tservers.MasterTest): class TestMaster(tservers.MasterTest):

View File

@ -16,8 +16,8 @@ def test_statusbar(monkeypatch):
anticache=True, anticache=True,
anticomp=True, anticomp=True,
showhost=True, showhost=True,
refresh_server_playback=False, server_replay_refresh=False,
replay_kill_extra=True, server_replay_kill_extra=True,
upstream_cert=False, upstream_cert=False,
stream_large_bodies="3m", stream_large_bodies="3m",
mode="transparent", mode="transparent",