minor fixes

This commit is contained in:
Maximilian Hils 2020-12-05 22:20:09 +01:00
parent 2d35c7bc4f
commit a115fff410
2 changed files with 13 additions and 4 deletions

View File

@ -23,7 +23,7 @@ from mitmproxy import ctx
from mitmproxy import io
from mitmproxy import http
from mitmproxy import tcp
from mitmproxy.utils import human
from mitmproxy.utils import compat, human
# The underlying sorted list implementation expects the sort key to be stable
@ -460,8 +460,12 @@ class View(collections.abc.Sequence):
req = http.HTTPRequest.make(method.upper(), url)
except ValueError as e:
raise exceptions.CommandError("Invalid URL: %s" % e)
c = connections.ClientConnection.make_dummy(("", 0))
s = connections.ServerConnection.make_dummy((req.host, req.port))
if compat.new_proxy_core: # pragma: no cover
c = compat.Client(("", 0), ("", 0), req.timestamp_start - 0.0001)
s = compat.Server((req.host, req.port))
else: # pragma: no cover
c = connections.ClientConnection.make_dummy(("", 0))
s = connections.ServerConnection.make_dummy((req.host, req.port))
f = http.HTTPFlow(c, s)
f.request = req
f.request.headers["Host"] = req.host

View File

@ -12,7 +12,12 @@ def maybe_timestamp(base, attr):
if base is not None and getattr(base, attr):
return human.format_timestamp_with_milli(getattr(base, attr))
else:
return "active"
# in mitmdump we serialize before a connection is closed.
# loading those flows at a later point shouldn't display "active".
# We also use a ndash (and not a regular dash) so that it is sorted
# after other timestamps. We may need to revisit that in the future if it turns out
# to render ugly in consoles.
return ""
def flowdetails(state, flow: mitmproxy.flow.Flow):