aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol
diff options
context:
space:
mode:
authorNick Raptis <airscorp@gmail.com>2015-05-08 10:58:05 +0300
committerNick Raptis <airscorp@gmail.com>2015-05-08 10:58:05 +0300
commit202ede3c546b3d99acee14f3bcceefd500e53c70 (patch)
treeffe89500c91d3704fc32f9846c95c877d4fb5021 /libmproxy/protocol
parent86526eed8dc566beb02f446edbd0e9773718846e (diff)
downloadmitmproxy-202ede3c546b3d99acee14f3bcceefd500e53c70.tar.gz
mitmproxy-202ede3c546b3d99acee14f3bcceefd500e53c70.tar.bz2
mitmproxy-202ede3c546b3d99acee14f3bcceefd500e53c70.zip
Accurately timestamp start of request
When building a request from a stream, try to get an accurate start timestamp from the Reader. This was already in the code and also used when building response objects, but was ommited in commit ddf458b330bf9fe200cb1dbc3ddb5ae1a5d2102a Without his logic and when the client is reusing a connection to send requests, the timestamp_start of subsequent requests is early and equal to when the connection started read blocking
Diffstat (limited to 'libmproxy/protocol')
-rw-r--r--libmproxy/protocol/http.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py
index 8d703786..7d80e0d8 100644
--- a/libmproxy/protocol/http.py
+++ b/libmproxy/protocol/http.py
@@ -344,6 +344,11 @@ class HTTPRequest(HTTPMessage):
body_size_limit = body_size_limit,
wfile = wfile
)
+
+ if hasattr(rfile, "first_byte_timestamp"):
+ # more accurate timestamp_start
+ timestamp_start = rfile.first_byte_timestamp
+
timestamp_end = utils.timestamp()
return HTTPRequest(
req.form_in,