New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net/http/httptrace: Add TLS handshake timing information #16965
Comments
/cc @bradfitz |
The delta between If nothing else, the godocs could be updated to make this more apparent. |
If there is interest in a CL for this I will submit one. I was thinking of adding the following methods to httptrace.ClientTrace: // TLSHandshakeStart is called when tls.Handshake() is started.
// When connecting to a https destination through a https proxy
// TLSHandshakeStart could be called twice
TLSHandshakeStart func()
// TLSHandshakeDone is called after tls.Handshake is done
// When connecting to a https destination through a https proxy
// TLSHandshakeDone could be called twice.
TLSHandshakeDone func(tls.ConnectionState) |
The "could be called twice" part is a little confusing. It should probably distinguish which conn it is. How do we deal with the proxy conn stuff elsewhere in httptrace? |
@bradfitz Looks like I misread the code last night. How just this instead... // TLSHandshakeStart is called when tls.Handshake() is started.
TLSHandshakeStart func()
// TLSHandshakeDone is called after tls.Handshake is done
TLSHandshakeDone func(tls.ConnectionState) Side Note: When we connect to a https site through a http proxy, the TLSHandshakeStart/Done fire after the CONNECT bridges the connection through the proxy. Not sure if we should bother calling that out or not. |
CL https://golang.org/cl/30359 mentions this issue. |
httptrace currently does not offer a way to measure the TLS handshake of a request when using https. This might be trivial to implement in net/http/transport.dialConn by adding a few more callbacks in httptrace. I suggest
TLSHandshakeStart
andTLSHandshakeDone
.A hacky solution I am considering for now is to use
ConnectDone
as a proxy forTLSHandshakeStart
andWroteRequest
as a proxy forTLSHandshakeDone
, but its better to have the real measurements.PS: Thanks a lot for httptrace. I am now removing lots of ugly hacks from my project and letting the standard library do its thing.
The text was updated successfully, but these errors were encountered: