Skip to content

Commit

Permalink
Accurately timestamp start of request
Browse files Browse the repository at this point in the history
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 ddf458b

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
  • Loading branch information
nickraptis committed May 8, 2015
1 parent 86526ee commit 202ede3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libmproxy/protocol/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,11 @@ def from_stream(cls, rfile, include_body=True, body_size_limit=None, wfile=None)
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,
Expand Down

0 comments on commit 202ede3

Please sign in to comment.