diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-05-16 18:24:32 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-05-16 18:24:32 +1200 |
commit | 0a90a3eaba98d9f6aa656e78847d4001d0a005c8 (patch) | |
tree | 501951f0a846d52483da820b1a97c6a09b49aead | |
parent | b3901a76527d9ce0f0429810147e5035f871e36a (diff) | |
download | mitmproxy-0a90a3eaba98d9f6aa656e78847d4001d0a005c8.tar.gz mitmproxy-0a90a3eaba98d9f6aa656e78847d4001d0a005c8.tar.bz2 mitmproxy-0a90a3eaba98d9f6aa656e78847d4001d0a005c8.zip |
Refuse to replay a request with missing content.
-rw-r--r-- | libmproxy/flow.py | 4 | ||||
-rw-r--r-- | test/test_flow.py | 10 |
2 files changed, 13 insertions, 1 deletions
diff --git a/libmproxy/flow.py b/libmproxy/flow.py index 3605019c..2258868b 100644 --- a/libmproxy/flow.py +++ b/libmproxy/flow.py @@ -1494,9 +1494,11 @@ class FlowMaster(controller.Master): """ Returns None if successful, or error message if not. """ - #begin nocover if f.intercepting: return "Can't replay while intercepting..." + if f.request.content == CONTENT_MISSING: + return "Can't replay request with missing content..." + #begin nocover if f.request: f.request._set_replay() if f.request.content: diff --git a/test/test_flow.py b/test/test_flow.py index d9933515..627d9cd0 100644 --- a/test/test_flow.py +++ b/test/test_flow.py @@ -516,6 +516,16 @@ class uFlowMaster(libpry.AutoTree): assert fm.load_script("nonexistent") assert "ValueError" in fm.load_script("scripts/starterr.py") + def test_replay(self): + s = flow.State() + fm = flow.FlowMaster(None, s) + f = tutils.tflow_full() + f.request.content = flow.CONTENT_MISSING + assert "missing" in fm.replay_request(f) + + f.intercepting = True + assert "intercepting" in fm.replay_request(f) + def test_script_reqerr(self): s = flow.State() fm = flow.FlowMaster(None, s) |