mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
improve timing display
This commit is contained in:
parent
610842cda5
commit
050431fdd6
@ -5,7 +5,7 @@ from .. import utils
|
|||||||
|
|
||||||
|
|
||||||
def maybe_timestamp(base, attr):
|
def maybe_timestamp(base, attr):
|
||||||
if base and getattr(base, attr):
|
if base is not None and getattr(base, attr):
|
||||||
return utils.format_timestamp_with_milli(getattr(base, attr))
|
return utils.format_timestamp_with_milli(getattr(base, attr))
|
||||||
else:
|
else:
|
||||||
return "active"
|
return "active"
|
||||||
@ -89,12 +89,21 @@ def flowdetails(state, flow):
|
|||||||
|
|
||||||
parts = []
|
parts = []
|
||||||
|
|
||||||
|
if cc is not None and cc.timestamp_start:
|
||||||
parts.append(
|
parts.append(
|
||||||
[
|
[
|
||||||
"Client conn. established",
|
"Client conn. established",
|
||||||
maybe_timestamp(cc, "timestamp_start")
|
maybe_timestamp(cc, "timestamp_start")
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
if cc.ssl_established:
|
||||||
|
parts.append(
|
||||||
|
[
|
||||||
|
"Client conn. TLS handshake",
|
||||||
|
maybe_timestamp(cc, "timestamp_ssl_setup")
|
||||||
|
]
|
||||||
|
)
|
||||||
|
if sc is not None and sc.timestamp_start:
|
||||||
parts.append(
|
parts.append(
|
||||||
[
|
[
|
||||||
"Server conn. initiated",
|
"Server conn. initiated",
|
||||||
@ -110,16 +119,11 @@ def flowdetails(state, flow):
|
|||||||
if sc.ssl_established:
|
if sc.ssl_established:
|
||||||
parts.append(
|
parts.append(
|
||||||
[
|
[
|
||||||
"Server conn. SSL handshake",
|
"Server conn. TLS handshake",
|
||||||
maybe_timestamp(sc, "timestamp_ssl_setup")
|
maybe_timestamp(sc, "timestamp_ssl_setup")
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
parts.append(
|
if req is not None and req.timestamp_start:
|
||||||
[
|
|
||||||
"Client conn. SSL handshake",
|
|
||||||
maybe_timestamp(cc, "timestamp_ssl_setup")
|
|
||||||
]
|
|
||||||
)
|
|
||||||
parts.append(
|
parts.append(
|
||||||
[
|
[
|
||||||
"First request byte",
|
"First request byte",
|
||||||
@ -132,6 +136,7 @@ def flowdetails(state, flow):
|
|||||||
maybe_timestamp(req, "timestamp_end")
|
maybe_timestamp(req, "timestamp_end")
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
if resp is not None and resp.timestamp_start:
|
||||||
parts.append(
|
parts.append(
|
||||||
[
|
[
|
||||||
"First response byte",
|
"First response byte",
|
||||||
@ -145,6 +150,7 @@ def flowdetails(state, flow):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if parts:
|
||||||
# sort operations by timestamp
|
# sort operations by timestamp
|
||||||
parts = sorted(parts, key=lambda p: p[1])
|
parts = sorted(parts, key=lambda p: p[1])
|
||||||
|
|
||||||
|
@ -838,9 +838,9 @@ class FlowMaster(controller.Master):
|
|||||||
address=dict(address=(host, port), use_ipv6=False),
|
address=dict(address=(host, port), use_ipv6=False),
|
||||||
clientcert=None,
|
clientcert=None,
|
||||||
ssl_established=False,
|
ssl_established=False,
|
||||||
timestamp_start=time.time(),
|
timestamp_start=None,
|
||||||
timestamp_end=time.time(),
|
timestamp_end=None,
|
||||||
timestamp_ssl_setup=time.time()
|
timestamp_ssl_setup=None
|
||||||
))
|
))
|
||||||
|
|
||||||
s = ServerConnection.from_state(dict(
|
s = ServerConnection.from_state(dict(
|
||||||
@ -850,9 +850,9 @@ class FlowMaster(controller.Master):
|
|||||||
sni=host,
|
sni=host,
|
||||||
source_address=dict(address=('', 0), use_ipv6=False),
|
source_address=dict(address=('', 0), use_ipv6=False),
|
||||||
ssl_established=True,
|
ssl_established=True,
|
||||||
timestamp_start=time.time(),
|
timestamp_start=None,
|
||||||
timestamp_tcp_setup=time.time(),
|
timestamp_tcp_setup=None,
|
||||||
timestamp_ssl_setup=time.time(),
|
timestamp_ssl_setup=None,
|
||||||
timestamp_end=None,
|
timestamp_end=None,
|
||||||
via=None
|
via=None
|
||||||
))
|
))
|
||||||
|
Loading…
Reference in New Issue
Block a user