mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 03:14:22 +00:00
Tweak timing display
- Remove elapsed time. Space is at a premium here, and this is somewhat redundant with the rate figure. We should display complete timing information somewhere in the detailed flow view. - Tone down the colour. Reserve highlights for stuff that should really pop out to the user. - Make rate calculation more acurate. Include header sizes. Use response start and end time, rather than request end and response end. This means that we show actual transfer rates, not including DNS requests and so forth.
This commit is contained in:
parent
09f651247a
commit
a2643b52f9
@ -144,9 +144,7 @@ def raw_format_flow(f, focus, extended, padding):
|
||||
if f["resp_ctype"]:
|
||||
resp.append(fcol(f["resp_ctype"], rc))
|
||||
resp.append(fcol(f["resp_clen"], rc))
|
||||
|
||||
resp.append(fcol(f["resp_et"], "time"))
|
||||
resp.append(fcol(f["resp_rate"], "highlight"))
|
||||
resp.append(fcol(f["resp_rate"], rc))
|
||||
|
||||
elif f["err_msg"]:
|
||||
resp.append(fcol(SYMBOL_RETURN, "error"))
|
||||
@ -190,15 +188,15 @@ def format_flow(f, focus, extended=False, hostheader=False, padding=2):
|
||||
else:
|
||||
contentdesc = "[no content]"
|
||||
|
||||
delta = f.response.timestamp_end - f.request.timestamp_start
|
||||
rate = utils.pretty_size(len(f.response.content) / delta)
|
||||
delta = f.response.timestamp_end - f.response.timestamp_start
|
||||
size = len(f.response.content) + f.response.get_header_size()
|
||||
rate = utils.pretty_size(size / delta)
|
||||
|
||||
d.update(dict(
|
||||
resp_code = f.response.code,
|
||||
resp_is_replay = f.response.is_replay(),
|
||||
resp_acked = f.response.reply.acked,
|
||||
resp_clen = contentdesc,
|
||||
resp_et = "{0:2.0f}ms".format(delta * 1000),
|
||||
resp_rate = "{0}/s".format(rate),
|
||||
))
|
||||
t = f.response.headers["content-type"]
|
||||
|
@ -35,7 +35,6 @@ palettes = {
|
||||
|
||||
('header', 'dark cyan', 'default'),
|
||||
('highlight', 'white,bold', 'default'),
|
||||
('time', 'light red', 'default'),
|
||||
('intercept', 'brown', 'default', None, '#f60', 'default'),
|
||||
('replay', 'light green', 'default', None, '#0f0', 'default'),
|
||||
('ack', 'light red', 'default'),
|
||||
|
@ -618,7 +618,7 @@ class Response(HTTPMsg):
|
||||
self.headers, self.content = headers, content
|
||||
self.cert = cert
|
||||
self.timestamp_start = timestamp_start or utils.timestamp()
|
||||
self.timestamp_end = max(timestamp_end or utils.timestamp(), timestamp_start)
|
||||
self.timestamp_end = timestamp_end or utils.timestamp()
|
||||
self.replay = False
|
||||
|
||||
def _refresh_cookie(self, c, delta):
|
||||
|
@ -88,11 +88,13 @@ class RequestReplayThread(threading.Thread):
|
||||
server = ServerConnection(self.config, r.scheme, r.host, r.port, r.host)
|
||||
server.connect()
|
||||
server.send(r)
|
||||
tsstart = utils.timestamp()
|
||||
httpversion, code, msg, headers, content = http.read_response(
|
||||
server.rfile, r.method, self.config.body_size_limit
|
||||
)
|
||||
response = flow.Response(
|
||||
self.flow.request, httpversion, code, msg, headers, content, server.cert
|
||||
self.flow.request, httpversion, code, msg, headers, content, server.cert,
|
||||
server.rfile.first_byte_timestamp
|
||||
)
|
||||
self.channel.ask(response)
|
||||
except (ProxyError, http.HttpError, tcp.NetLibError), v:
|
||||
@ -224,6 +226,7 @@ class ProxyHandler(tcp.BaseHandler):
|
||||
request.ssl_setup_timestamp = sc.ssl_setup_timestamp
|
||||
sc.rfile.reset_timestamps()
|
||||
try:
|
||||
tsstart = utils.timestamp()
|
||||
httpversion, code, msg, headers, content = http.read_response(
|
||||
sc.rfile,
|
||||
request.method,
|
||||
@ -242,7 +245,7 @@ class ProxyHandler(tcp.BaseHandler):
|
||||
|
||||
response = flow.Response(
|
||||
request, httpversion, code, msg, headers, content, sc.cert,
|
||||
sc.rfile.first_byte_timestamp, utils.timestamp()
|
||||
sc.rfile.first_byte_timestamp
|
||||
)
|
||||
response_reply = self.channel.ask(response)
|
||||
# Not replying to the server invalidates the server
|
||||
|
Loading…
Reference in New Issue
Block a user