diff options
author | Erik Dubbelboer <erik@dubbelboer.com> | 2022-09-03 11:02:32 +0200 |
---|---|---|
committer | Erik Dubbelboer <erik@dubbelboer.com> | 2022-09-03 11:02:32 +0200 |
commit | 2f1e949d91d0ba1817afd80d7c981fafe7154774 (patch) | |
tree | 63c8974ed4f595696f7f93a454978525fcf4db76 /client.go | |
parent | Chore (#1365) (diff) | |
download | fasthttp-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.go | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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 |