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 ddf458b330

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
This commit is contained in:
Nick Raptis 2015-05-08 10:58:05 +03:00
parent 86526eed8d
commit 202ede3c54

View File

@ -344,6 +344,11 @@ class HTTPRequest(HTTPMessage):
body_size_limit = body_size_limit, body_size_limit = body_size_limit,
wfile = wfile wfile = wfile
) )
if hasattr(rfile, "first_byte_timestamp"):
# more accurate timestamp_start
timestamp_start = rfile.first_byte_timestamp
timestamp_end = utils.timestamp() timestamp_end = utils.timestamp()
return HTTPRequest( return HTTPRequest(
req.form_in, req.form_in,