1
0
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:
源文雨
2024-04-19 01:05:59 +09:00
parent 719e0c1683
commit 406b2cbe1d
2 changed files with 8 additions and 0 deletions

View File

@@ -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
},
},

View File

@@ -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
},
},