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
This commit is contained in:
Catherine
2026-05-30 14:12:23 +00:00
parent c8dba5dcb5
commit 8883c78250
+2 -1
View File
@@ -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
}