From 8883c78250f6906ea458bc27fc30372caa37326c Mon Sep 17 00:00:00 2001 From: Catherine Date: Sat, 30 May 2026 14:12:23 +0000 Subject: [PATCH] Pass context to `tls.Dialer` in `tryDialWithSNI`. This cleans up resources that would otherwise be tied up by Caddy endpoint requests where the originating TLS connection to Caddy has went away. V12-Ref: F-77195 --- src/caddy.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/caddy.go b/src/caddy.go index c6640a6..d98c53b 100644 --- a/src/caddy.go +++ b/src/caddy.go @@ -81,7 +81,8 @@ func tryDialWithSNI(ctx context.Context, domain string) (bool, error) { } logc.Printf(ctx, "caddy: check TLS %s", fallbackURL) - connection, err := tls.Dial("tcp", connectHost, &tls.Config{ServerName: domain}) + dialer := tls.Dialer{Config: &tls.Config{ServerName: domain}} + connection, err := dialer.DialContext(ctx, "tcp", connectHost) if err != nil { return false, err }