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)
|
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):
|
def ready_actions(length, lst):
|
||||||
ret = []
|
ret = []
|
||||||
for i in lst:
|
for i in lst:
|
||||||
@ -620,7 +608,6 @@ class Message:
|
|||||||
err.serve(fp)
|
err.serve(fp)
|
||||||
return dict(
|
return dict(
|
||||||
disconnect = True,
|
disconnect = True,
|
||||||
actions = actions_log(actions),
|
|
||||||
error = ret
|
error = ret
|
||||||
)
|
)
|
||||||
disconnect = write_values(fp, vals, actions[:])
|
disconnect = write_values(fp, vals, actions[:])
|
||||||
@ -629,7 +616,6 @@ class Message:
|
|||||||
disconnect = disconnect,
|
disconnect = disconnect,
|
||||||
started = started,
|
started = started,
|
||||||
duration = duration,
|
duration = duration,
|
||||||
actions = actions_log(actions),
|
|
||||||
)
|
)
|
||||||
for i in self.logattrs:
|
for i in self.logattrs:
|
||||||
v = getattr(self, i)
|
v = getattr(self, i)
|
||||||
@ -656,8 +642,8 @@ class Response(Message):
|
|||||||
logattrs = ["code", "version", "body"]
|
logattrs = ["code", "version", "body"]
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Message.__init__(self)
|
Message.__init__(self)
|
||||||
self.code = 200
|
self.code = None
|
||||||
self.msg = LiteralGenerator(http_status.RESPONSES[self.code])
|
self.msg = None
|
||||||
|
|
||||||
def preamble(self):
|
def preamble(self):
|
||||||
return [self.version, " ", str(self.code), " ", self.msg]
|
return [self.version, " ", str(self.code), " ", self.msg]
|
||||||
|
@ -83,13 +83,6 @@ class Pathoc(tcp.TCPClient):
|
|||||||
if req:
|
if req:
|
||||||
if ignorecodes and resp and resp[1] in ignorecodes:
|
if ignorecodes and resp and resp[1] in ignorecodes:
|
||||||
return
|
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:
|
if showreq:
|
||||||
self._show(fp, ">> Request", self.wfile.get_log(), hexdump)
|
self._show(fp, ">> Request", self.wfile.get_log(), hexdump)
|
||||||
|
|
||||||
|
@ -75,12 +75,8 @@ class TestDaemon:
|
|||||||
def test_conn_err(self):
|
def test_conn_err(self):
|
||||||
assert "Invalid server response" in self.tval(["get:'/p/200:d2'"])
|
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):
|
def test_fileread(self):
|
||||||
d = tutils.test_data.path("data/request")
|
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"])
|
assert "File" in self.tval(["+/nonexistent"])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user