1
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-16 21:56:40 -05:00

caddytls: Check for nil ALPN; close #5470 (#5473)

* Check for nil ALPN; close #5470

* Apply patch

* Actually I want to try this
This commit is contained in:
Matt Holt 2023-05-13 07:09:20 -06:00 committed by GitHub
parent 5ebb7d496d
commit a02ecb0f88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,7 +54,7 @@ func (cp ConnectionPolicies) Provision(ctx caddy.Context) error {
} }
// enable HTTP/2 by default // enable HTTP/2 by default
if len(pol.ALPN) == 0 { if pol.ALPN == nil {
pol.ALPN = append(pol.ALPN, defaultALPN...) pol.ALPN = append(pol.ALPN, defaultALPN...)
} }
@ -283,7 +283,7 @@ func (p *ConnectionPolicy) buildStandardTLSConfig(ctx caddy.Context) error {
break break
} }
} }
if !alpnFound { if !alpnFound && (cfg.NextProtos == nil || len(cfg.NextProtos) > 0) {
cfg.NextProtos = append(cfg.NextProtos, acmez.ACMETLS1Protocol) cfg.NextProtos = append(cfg.NextProtos, acmez.ACMETLS1Protocol)
} }