mirror of
https://github.com/caddyserver/caddy.git
synced 2026-05-13 09:06:41 +00:00
Some checks are pending
Tests / test (./cmd/caddy/caddy, ~1.26.0, macos-14, 0, 1.26, mac) (push) Waiting to run
Tests / test (./cmd/caddy/caddy, ~1.26.0, ubuntu-latest, 0, 1.26, linux) (push) Waiting to run
Tests / test (./cmd/caddy/caddy.exe, ~1.26.0, windows-latest, True, 1.26, windows) (push) Waiting to run
Tests / test (s390x on IBM Z) (push) Waiting to run
Tests / goreleaser-check (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, aix) (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, darwin) (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, dragonfly) (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, freebsd) (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, illumos) (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, linux) (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, netbsd) (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, openbsd) (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, solaris) (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, windows) (push) Waiting to run
Lint / lint (push) Waiting to run
Lint / lint-1 (push) Waiting to run
Lint / lint-2 (push) Waiting to run
Lint / govulncheck (push) Waiting to run
Lint / dependency-review (push) Waiting to run
OpenSSF Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
* tls: add alpn to managed HTTPS records * tls: centralise HTTPS RR ALPN defaults and registration Reuse shared protocol defaults instead of repeating the default HTTP protocol list, unify server name registration to carry ALPN in one experimental API and reuse the TLS default ALPN ordering for HTTPS RR publication * http: centralise effective protocol resolution for HTTPS RR ALPN
47 lines
884 B
Go
47 lines
884 B
Go
package caddyhttp
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestHTTPSRRALPNsDefaultProtocols(t *testing.T) {
|
|
srv := &Server{}
|
|
|
|
got := httpsRRALPNs(srv)
|
|
want := []string{"h3", "h2", "http/1.1"}
|
|
|
|
if !reflect.DeepEqual(got, want) {
|
|
t.Fatalf("unexpected ALPN values: got %v want %v", got, want)
|
|
}
|
|
}
|
|
|
|
func TestHTTPSRRALPNsListenProtocolOverrides(t *testing.T) {
|
|
srv := &Server{
|
|
Protocols: []string{"h1", "h2"},
|
|
ListenProtocols: [][]string{
|
|
{"h1"},
|
|
nil,
|
|
{},
|
|
{"h3", ""},
|
|
},
|
|
}
|
|
|
|
got := httpsRRALPNs(srv)
|
|
want := []string{"h3", "h2", "http/1.1"}
|
|
|
|
if !reflect.DeepEqual(got, want) {
|
|
t.Fatalf("unexpected ALPN values: got %v want %v", got, want)
|
|
}
|
|
}
|
|
|
|
func TestHTTPSRRALPNsIgnoresH2COnly(t *testing.T) {
|
|
srv := &Server{
|
|
Protocols: []string{"h2c"},
|
|
}
|
|
|
|
got := httpsRRALPNs(srv)
|
|
if len(got) != 0 {
|
|
t.Fatalf("unexpected ALPN values: got %v want none", got)
|
|
}
|
|
}
|