From 355c3b2be7fe275480a5c3e5cecfe32693256da3 Mon Sep 17 00:00:00 2001 From: Matthias Gabriel Date: Fri, 13 Jan 2023 11:53:13 +0100 Subject: [PATCH] control/controlhttp: fix header case-sensitivity Change-Id: I49269bc969a80382997ec5c9de33c4f56d9dc787 Signed-off-by: Matthias Gabriel --- control/controlhttp/server.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/control/controlhttp/server.go b/control/controlhttp/server.go index 6aed6ea39..e789510f5 100644 --- a/control/controlhttp/server.go +++ b/control/controlhttp/server.go @@ -12,6 +12,7 @@ import ( "io" "net" "net/http" + "strings" "time" "nhooyr.io/websocket" @@ -35,7 +36,7 @@ func AcceptHTTP(ctx context.Context, w http.ResponseWriter, r *http.Request, pri } func acceptHTTP(ctx context.Context, w http.ResponseWriter, r *http.Request, private key.MachinePrivate, earlyWrite func(protocolVersion int, w io.Writer) error) (_ *controlbase.Conn, retErr error) { - next := r.Header.Get("Upgrade") + next := strings.ToLower(r.Header.Get("Upgrade")) if next == "" { http.Error(w, "missing next protocol", http.StatusBadRequest) return nil, errors.New("no next protocol in HTTP request")