mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 03:14:22 +00:00
Refine semantics of replay_request method.
This commit is contained in:
parent
04d9ec8c3c
commit
01b8b0d876
@ -1361,7 +1361,7 @@ class FlowMaster(controller.Master):
|
|||||||
if self.stickycookie_state:
|
if self.stickycookie_state:
|
||||||
self.stickycookie_state.handle_response(f)
|
self.stickycookie_state.handle_response(f)
|
||||||
|
|
||||||
def replay_request(self, f):
|
def replay_request(self, f, block=False):
|
||||||
"""
|
"""
|
||||||
Returns None if successful, or error message if not.
|
Returns None if successful, or error message if not.
|
||||||
"""
|
"""
|
||||||
@ -1382,7 +1382,8 @@ class FlowMaster(controller.Master):
|
|||||||
self.masterq,
|
self.masterq,
|
||||||
)
|
)
|
||||||
rt.start() # pragma: no cover
|
rt.start() # pragma: no cover
|
||||||
return rt
|
if block:
|
||||||
|
rt.join()
|
||||||
|
|
||||||
def run_script_hook(self, name, *args, **kwargs):
|
def run_script_hook(self, name, *args, **kwargs):
|
||||||
if self.script and not self.pause_scripts:
|
if self.script and not self.pause_scripts:
|
||||||
|
@ -26,20 +26,17 @@ class SanityMixin:
|
|||||||
l = self.master.state.view[0]
|
l = self.master.state.view[0]
|
||||||
assert l.response.code == 304
|
assert l.response.code == 304
|
||||||
l.request.path = "/p/305"
|
l.request.path = "/p/305"
|
||||||
rt = self.master.replay_request(l)
|
rt = self.master.replay_request(l, block=True)
|
||||||
rt.join()
|
|
||||||
assert l.response.code == 305
|
assert l.response.code == 305
|
||||||
|
|
||||||
# Disconnect error
|
# Disconnect error
|
||||||
l.request.path = "/p/305:d0"
|
l.request.path = "/p/305:d0"
|
||||||
rt = self.master.replay_request(l)
|
rt = self.master.replay_request(l, block=True)
|
||||||
rt.join()
|
|
||||||
assert l.error
|
assert l.error
|
||||||
|
|
||||||
# Port error
|
# Port error
|
||||||
l.request.port = 1
|
l.request.port = 1
|
||||||
rt = self.master.replay_request(l)
|
rt = self.master.replay_request(l, block=True)
|
||||||
rt.join()
|
|
||||||
assert l.error
|
assert l.error
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user