mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
Merge branch 'issue_341' into server_change_api
Conflicts: examples/redirect_requests.py libmproxy/console/common.py
This commit is contained in:
commit
ea55f2e012
@ -12,7 +12,7 @@ def request(context, flow):
|
|||||||
[1, 1], 200, "OK",
|
[1, 1], 200, "OK",
|
||||||
ODictCaseless([["Content-Type", "text/html"]]),
|
ODictCaseless([["Content-Type", "text/html"]]),
|
||||||
"helloworld")
|
"helloworld")
|
||||||
flow.request.reply(resp)
|
flow.reply(resp)
|
||||||
if flow.request.pretty_host(hostheader=True).endswith("example.org"):
|
if flow.request.pretty_host(hostheader=True).endswith("example.org"):
|
||||||
flow.request.host = "mitmproxy.org"
|
flow.request.host = "mitmproxy.org"
|
||||||
flow.request.update_host_header()
|
flow.request.update_host_header()
|
||||||
|
@ -108,7 +108,7 @@ def raw_format_flow(f, focus, extended, padding):
|
|||||||
|
|
||||||
preamble = sum(i[1] for i in req) + len(req) -1
|
preamble = sum(i[1] for i in req) + len(req) -1
|
||||||
|
|
||||||
if f["intercepting"] and not f["req_acked"]:
|
if f["intercepting"] and not f["acked"]:
|
||||||
uc = "intercept"
|
uc = "intercept"
|
||||||
elif f["resp_code"] or f["err_msg"]:
|
elif f["resp_code"] or f["err_msg"]:
|
||||||
uc = "text"
|
uc = "text"
|
||||||
@ -138,7 +138,7 @@ def raw_format_flow(f, focus, extended, padding):
|
|||||||
if f["resp_is_replay"]:
|
if f["resp_is_replay"]:
|
||||||
resp.append(fcol(SYMBOL_REPLAY, "replay"))
|
resp.append(fcol(SYMBOL_REPLAY, "replay"))
|
||||||
resp.append(fcol(f["resp_code"], ccol))
|
resp.append(fcol(f["resp_code"], ccol))
|
||||||
if f["intercepting"] and f["resp_code"] and not f["resp_acked"]:
|
if f["intercepting"] and f["resp_code"] and not f["acked"]:
|
||||||
rc = "intercept"
|
rc = "intercept"
|
||||||
else:
|
else:
|
||||||
rc = "text"
|
rc = "text"
|
||||||
@ -172,11 +172,11 @@ flowcache = FlowCache()
|
|||||||
def format_flow(f, focus, extended=False, hostheader=False, padding=2):
|
def format_flow(f, focus, extended=False, hostheader=False, padding=2):
|
||||||
d = dict(
|
d = dict(
|
||||||
intercepting = f.intercepting,
|
intercepting = f.intercepting,
|
||||||
|
acked = f.reply.acked,
|
||||||
|
|
||||||
req_timestamp = f.request.timestamp_start,
|
req_timestamp = f.request.timestamp_start,
|
||||||
req_is_replay = f.request.is_replay,
|
req_is_replay = f.request.is_replay,
|
||||||
req_method = f.request.method,
|
req_method = f.request.method,
|
||||||
req_acked = f.request.reply.acked,
|
|
||||||
req_url = f.request.pretty_url(hostheader=hostheader),
|
req_url = f.request.pretty_url(hostheader=hostheader),
|
||||||
|
|
||||||
err_msg = f.error.msg if f.error else None,
|
err_msg = f.error.msg if f.error else None,
|
||||||
@ -197,7 +197,6 @@ def format_flow(f, focus, extended=False, hostheader=False, padding=2):
|
|||||||
d.update(dict(
|
d.update(dict(
|
||||||
resp_code = f.response.code,
|
resp_code = f.response.code,
|
||||||
resp_is_replay = f.response.is_replay,
|
resp_is_replay = f.response.is_replay,
|
||||||
resp_acked = f.response.reply.acked,
|
|
||||||
resp_clen = contentdesc,
|
resp_clen = contentdesc,
|
||||||
resp_rate = "{0}/s".format(rate),
|
resp_rate = "{0}/s".format(rate),
|
||||||
))
|
))
|
||||||
|
@ -233,7 +233,7 @@ class FlowView(common.WWrap):
|
|||||||
def wrap_body(self, active, body):
|
def wrap_body(self, active, body):
|
||||||
parts = []
|
parts = []
|
||||||
|
|
||||||
if self.flow.intercepting and not self.flow.request.reply.acked:
|
if self.flow.intercepting and not self.flow.reply.acked and not self.flow.response:
|
||||||
qt = "Request intercepted"
|
qt = "Request intercepted"
|
||||||
else:
|
else:
|
||||||
qt = "Request"
|
qt = "Request"
|
||||||
@ -242,7 +242,7 @@ class FlowView(common.WWrap):
|
|||||||
else:
|
else:
|
||||||
parts.append(self._tab(qt, "heading_inactive"))
|
parts.append(self._tab(qt, "heading_inactive"))
|
||||||
|
|
||||||
if self.flow.intercepting and self.flow.response and not self.flow.response.reply.acked:
|
if self.flow.intercepting and not self.flow.reply.acked and self.flow.response:
|
||||||
st = "Response intercepted"
|
st = "Response intercepted"
|
||||||
else:
|
else:
|
||||||
st = "Response"
|
st = "Response"
|
||||||
|
@ -183,8 +183,7 @@ class ClientPlaybackState:
|
|||||||
"""
|
"""
|
||||||
if self.flows and not self.current:
|
if self.flows and not self.current:
|
||||||
n = self.flows.pop(0)
|
n = self.flows.pop(0)
|
||||||
n.request.reply = controller.DummyReply()
|
n.reply = controller.DummyReply()
|
||||||
n.client_conn = None
|
|
||||||
self.current = master.handle_request(n)
|
self.current = master.handle_request(n)
|
||||||
if not testing and not self.current.response:
|
if not testing and not self.current.response:
|
||||||
master.replay_request(self.current) # pragma: no cover
|
master.replay_request(self.current) # pragma: no cover
|
||||||
|
Loading…
Reference in New Issue
Block a user