From a02ecb0f88cb1c290c0cf940431aff8a6e1891ed Mon Sep 17 00:00:00 2001 From: Matt Holt Date: Sat, 13 May 2023 07:09:20 -0600 Subject: [PATCH] caddytls: Check for nil ALPN; close #5470 (#5473) * Check for nil ALPN; close #5470 * Apply patch * Actually I want to try this --- modules/caddytls/connpolicy.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/caddytls/connpolicy.go b/modules/caddytls/connpolicy.go index 46a8eda3..a4dc4119 100644 --- a/modules/caddytls/connpolicy.go +++ b/modules/caddytls/connpolicy.go @@ -54,7 +54,7 @@ func (cp ConnectionPolicies) Provision(ctx caddy.Context) error { } // enable HTTP/2 by default - if len(pol.ALPN) == 0 { + if pol.ALPN == nil { pol.ALPN = append(pol.ALPN, defaultALPN...) } @@ -283,7 +283,7 @@ func (p *ConnectionPolicy) buildStandardTLSConfig(ctx caddy.Context) error { break } } - if !alpnFound { + if !alpnFound && (cfg.NextProtos == nil || len(cfg.NextProtos) > 0) { cfg.NextProtos = append(cfg.NextProtos, acmez.ACMETLS1Protocol) }