aboutsummaryrefslogtreecommitdiff
path: root/client.go
diff options
context:
space:
mode:
authorGravatar Erik Dubbelboer <erik@dubbelboer.com> 2022-09-03 11:02:32 +0200
committerGravatar Erik Dubbelboer <erik@dubbelboer.com> 2022-09-03 11:02:32 +0200
commit2f1e949d91d0ba1817afd80d7c981fafe7154774 (patch)
tree63c8974ed4f595696f7f93a454978525fcf4db76 /client.go
parentChore (#1365) (diff)
downloadfasthttp-2f1e949d91d0ba1817afd80d7c981fafe7154774.tar.gz
fasthttp-2f1e949d91d0ba1817afd80d7c981fafe7154774.tar.bz2
fasthttp-2f1e949d91d0ba1817afd80d7c981fafe7154774.zip
Improve isTLSAlready checkv1.40.0
All conn implementations having a Handshake() error method are now seen as a TLS conn and aren't wrapped in another tls.Client.
Diffstat (limited to 'client.go')
-rw-r--r--client.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/client.go b/client.go
index 0ded492..7af216c 100644
--- a/client.go
+++ b/client.go
@@ -1976,7 +1976,11 @@ func dialAddr(addr string, dial DialFunc, dialDualStack, isTLS bool, tlsConfig *
if conn == nil {
panic("BUG: DialFunc returned (nil, nil)")
}
- _, isTLSAlready := conn.(*tls.Conn)
+
+ // We assume that any conn that has the Handshake() method is a TLS conn already.
+ // This doesn't cover just tls.Conn but also other TLS implementations.
+ _, isTLSAlready := conn.(interface{ Handshake() error })
+
if isTLS && !isTLSAlready {
if timeout == 0 {
return tls.Client(conn, tlsConfig), nil