mirror of
https://github.com/fumiama/terasu.git
synced 2026-06-05 01:00:23 +08:00
fix: check nil tls conn
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ErrNoTLSConnection = errors.New("no tls connection")
|
||||
ErrEmptyHostAddress = errors.New("empty host addr")
|
||||
)
|
||||
|
||||
@@ -75,6 +76,9 @@ var DefaultClient = http.Client{
|
||||
_ = tlsConn.Close()
|
||||
tlsConn = nil
|
||||
}
|
||||
if tlsConn == nil {
|
||||
return nil, ErrNoTLSConnection
|
||||
}
|
||||
return tlsConn, err
|
||||
},
|
||||
},
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ErrNoTLSConnection = errors.New("no tls connection")
|
||||
ErrEmptyHostAddress = errors.New("empty host addr")
|
||||
)
|
||||
|
||||
@@ -74,6 +75,9 @@ var DefaultClient = http.Client{
|
||||
_ = tlsConn.Close()
|
||||
tlsConn = nil
|
||||
}
|
||||
if tlsConn == nil {
|
||||
return nil, ErrNoTLSConnection
|
||||
}
|
||||
return tlsConn, err
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user