mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-29 02:57:19 +00:00
fix timestamp formatting: end_time may not be set
This commit is contained in:
parent
45f39c2380
commit
4167713cc0
@ -190,7 +190,10 @@ def format_flow(f, focus, extended=False, hostheader=False, padding=2):
|
|||||||
else:
|
else:
|
||||||
contentdesc = "[no content]"
|
contentdesc = "[no content]"
|
||||||
|
|
||||||
delta = f.response.timestamp_end - f.response.timestamp_start
|
if f.response.timestamp_end:
|
||||||
|
delta = f.response.timestamp_end - f.response.timestamp_start
|
||||||
|
else:
|
||||||
|
delta = 0
|
||||||
size = f.response.size()
|
size = f.response.size()
|
||||||
rate = utils.pretty_size(size / ( delta if delta > 0 else 1 ) )
|
rate = utils.pretty_size(size / ( delta if delta > 0 else 1 ) )
|
||||||
|
|
||||||
|
@ -89,6 +89,7 @@ class HTTPMessage(stateobject.StateObject):
|
|||||||
"""
|
"""
|
||||||
Base class for HTTPRequest and HTTPResponse
|
Base class for HTTPRequest and HTTPResponse
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, httpversion, headers, content, timestamp_start=None,
|
def __init__(self, httpversion, headers, content, timestamp_start=None,
|
||||||
timestamp_end=None):
|
timestamp_end=None):
|
||||||
self.httpversion = httpversion
|
self.httpversion = httpversion
|
||||||
@ -917,6 +918,7 @@ class HTTPHandler(ProtocolHandler):
|
|||||||
HTTPHandler implements mitmproxys understanding of the HTTP protocol.
|
HTTPHandler implements mitmproxys understanding of the HTTP protocol.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, c):
|
def __init__(self, c):
|
||||||
super(HTTPHandler, self).__init__(c)
|
super(HTTPHandler, self).__init__(c)
|
||||||
self.expected_form_in = c.config.mode.http_form_in
|
self.expected_form_in = c.config.mode.http_form_in
|
||||||
@ -980,8 +982,8 @@ class HTTPHandler(ProtocolHandler):
|
|||||||
body_size_limit=self.c.config.body_size_limit
|
body_size_limit=self.c.config.body_size_limit
|
||||||
)
|
)
|
||||||
except tcp.NetLibDisconnect:
|
except tcp.NetLibDisconnect:
|
||||||
# don't throw an error for disconnects that happen
|
# don't throw an error for disconnects that happen
|
||||||
# before/between requests.
|
# before/between requests.
|
||||||
return False
|
return False
|
||||||
self.c.log(
|
self.c.log(
|
||||||
"request",
|
"request",
|
||||||
|
Loading…
Reference in New Issue
Block a user