mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
Remove actions log and explain, preparing for a more sophisticated take on this.
This commit is contained in:
parent
2bdb5d15b9
commit
495daf2b64
@ -25,18 +25,6 @@ class ParseException(Exception):
|
||||
return "%s at char %s"%(self.msg, self.col)
|
||||
|
||||
|
||||
def actions_log(lst):
|
||||
ret = []
|
||||
for i in lst:
|
||||
if i[1] == "inject":
|
||||
ret.append(
|
||||
[i[0], i[1], repr(i[2])]
|
||||
)
|
||||
else:
|
||||
ret.append(i)
|
||||
return ret
|
||||
|
||||
|
||||
def ready_actions(length, lst):
|
||||
ret = []
|
||||
for i in lst:
|
||||
@ -620,7 +608,6 @@ class Message:
|
||||
err.serve(fp)
|
||||
return dict(
|
||||
disconnect = True,
|
||||
actions = actions_log(actions),
|
||||
error = ret
|
||||
)
|
||||
disconnect = write_values(fp, vals, actions[:])
|
||||
@ -629,7 +616,6 @@ class Message:
|
||||
disconnect = disconnect,
|
||||
started = started,
|
||||
duration = duration,
|
||||
actions = actions_log(actions),
|
||||
)
|
||||
for i in self.logattrs:
|
||||
v = getattr(self, i)
|
||||
@ -656,8 +642,8 @@ class Response(Message):
|
||||
logattrs = ["code", "version", "body"]
|
||||
def __init__(self):
|
||||
Message.__init__(self)
|
||||
self.code = 200
|
||||
self.msg = LiteralGenerator(http_status.RESPONSES[self.code])
|
||||
self.code = None
|
||||
self.msg = None
|
||||
|
||||
def preamble(self):
|
||||
return [self.version, " ", str(self.code), " ", self.msg]
|
||||
|
@ -83,13 +83,6 @@ class Pathoc(tcp.TCPClient):
|
||||
if req:
|
||||
if ignorecodes and resp and resp[1] in ignorecodes:
|
||||
return
|
||||
if explain:
|
||||
print >> fp, ">>", req["method"], repr(req["path"])
|
||||
for a in req["actions"]:
|
||||
print >> fp, "\t",
|
||||
for x in a:
|
||||
print >> fp, x,
|
||||
print >> fp
|
||||
if showreq:
|
||||
self._show(fp, ">> Request", self.wfile.get_log(), hexdump)
|
||||
|
||||
|
@ -75,12 +75,8 @@ class TestDaemon:
|
||||
def test_conn_err(self):
|
||||
assert "Invalid server response" in self.tval(["get:'/p/200:d2'"])
|
||||
|
||||
def test_explain(self):
|
||||
reqs = [ "get:/api/info:ir,'x'"]
|
||||
assert "inject" in self.tval(reqs, explain=True)
|
||||
|
||||
def test_fileread(self):
|
||||
d = tutils.test_data.path("data/request")
|
||||
assert "foo" in self.tval(["+%s"%d], explain=True)
|
||||
assert "foo" in self.tval(["+%s"%d], showreq=True)
|
||||
assert "File" in self.tval(["+/nonexistent"])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user