mirror of
https://github.com/golang/go
synced 2024-11-26 15:46:54 -07:00
net/http: check for nil, nil return from DialContext as well as Dial
This commit is contained in:
parent
de6abd7889
commit
fd9b0c4193
@ -1173,7 +1173,11 @@ var zeroDialer net.Dialer
|
||||
|
||||
func (t *Transport) dial(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
if t.DialContext != nil {
|
||||
return t.DialContext(ctx, network, addr)
|
||||
c, err := t.DialContext(ctx, network, addr)
|
||||
if c == nil && err == nil {
|
||||
err = errors.New("net/http: Transport.DialContext hook returned (nil, nil)")
|
||||
}
|
||||
return c, err
|
||||
}
|
||||
if t.Dial != nil {
|
||||
c, err := t.Dial(network, addr)
|
||||
|
Loading…
Reference in New Issue
Block a user