-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
Description
Currently this library unconditionally invokes the httptrace.ClientTrace GotConn callback after dialing.
Lines 291 to 299 in b65e629
netConn, err := netDial("tcp", hostPort) | |
if trace != nil && trace.GotConn != nil { | |
trace.GotConn(httptrace.GotConnInfo{ | |
Conn: netConn, | |
}) | |
} | |
if err != nil { | |
return nil, nil, err | |
} |
However, the documentation from httptrace specifically states that it will only be called after a successful dial. https://pkg.go.dev/net/http/httptrace#ClientTrace
// GotConn is called after a successful connection is
// obtained. There is no hook for failure to obtain a
// connection; instead, use the error from
// Transport.RoundTrip.
GotConn func(GotConnInfo)
Consequently, this library should do the error check first.