From d84280107c7dc2d82e5d50349809962044dff83c Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Tue, 21 Oct 2025 08:39:05 +0200 Subject: [PATCH] chore: linter: canonicalheader Signed-off-by: Jakob Borg --- cmd/infra/stcrashreceiver/util.go | 2 +- cmd/stdiscosrv/apisrv.go | 2 +- cmd/syncthing/cli/client.go | 2 +- lib/api/tokenmanager.go | 4 ++-- lib/rc/rc.go | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/infra/stcrashreceiver/util.go b/cmd/infra/stcrashreceiver/util.go index 9e1261c8a..4e00d6fb6 100644 --- a/cmd/infra/stcrashreceiver/util.go +++ b/cmd/infra/stcrashreceiver/util.go @@ -23,7 +23,7 @@ import ( // remote IP, and the current month. func userIDFor(req *http.Request) string { addr := req.RemoteAddr - if fwd := req.Header.Get("x-forwarded-for"); fwd != "" { + if fwd := req.Header.Get("X-Forwarded-For"); fwd != "" { addr = fwd } if host, _, err := net.SplitHostPort(addr); err == nil { diff --git a/cmd/stdiscosrv/apisrv.go b/cmd/stdiscosrv/apisrv.go index ec0c3520e..dc585a48e 100644 --- a/cmd/stdiscosrv/apisrv.go +++ b/cmd/stdiscosrv/apisrv.go @@ -350,7 +350,7 @@ func certificateBytes(req *http.Request) ([]byte, error) { var bs []byte - if hdr := req.Header.Get("X-SSL-Cert"); hdr != "" { + if hdr := req.Header.Get("X-Ssl-Cert"); hdr != "" { if strings.Contains(hdr, "%") { // Nginx using $ssl_client_escaped_cert // The certificate is in PEM format with url encoding. diff --git a/cmd/syncthing/cli/client.go b/cmd/syncthing/cli/client.go index 7e0d8749e..7d618b8e3 100644 --- a/cmd/syncthing/cli/client.go +++ b/cmd/syncthing/cli/client.go @@ -113,7 +113,7 @@ func (c *apiClient) Endpoint() string { } func (c *apiClient) Do(req *http.Request) (*http.Response, error) { - req.Header.Set("X-API-Key", c.apikey) + req.Header.Set("X-Api-Key", c.apikey) resp, err := c.Client.Do(req) if err != nil { return nil, err diff --git a/lib/api/tokenmanager.go b/lib/api/tokenmanager.go index f0bc7365d..62aad7bb2 100644 --- a/lib/api/tokenmanager.go +++ b/lib/api/tokenmanager.go @@ -168,8 +168,8 @@ func (m *tokenCookieManager) createSession(username string, persistent bool, w h // either directly to us, or as used by the client towards a reverse // proxy who sends us headers. connectionIsHTTPS := r.TLS != nil || - strings.ToLower(r.Header.Get("x-forwarded-proto")) == "https" || - strings.Contains(strings.ToLower(r.Header.Get("forwarded")), "proto=https") + strings.ToLower(r.Header.Get("X-Forwarded-Proto")) == "https" || + strings.Contains(strings.ToLower(r.Header.Get("Forwarded")), "proto=https") // If the connection is HTTPS, or *should* be HTTPS, set the Secure // bit in cookies. useSecureCookie := connectionIsHTTPS || m.guiCfg.UseTLS() diff --git a/lib/rc/rc.go b/lib/rc/rc.go index 5b57f4d4b..e218c33d3 100644 --- a/lib/rc/rc.go +++ b/lib/rc/rc.go @@ -178,7 +178,7 @@ func (p *Process) Get(path string) ([]byte, error) { return nil, err } - req.Header.Add("X-API-Key", APIKey) + req.Header.Add("X-Api-Key", APIKey) resp, err := client.Do(req) if err != nil { @@ -203,7 +203,7 @@ func (p *Process) Post(path string, data io.Reader) ([]byte, error) { return nil, err } - req.Header.Add("X-API-Key", APIKey) + req.Header.Add("X-Api-Key", APIKey) req.Header.Add("Content-Type", "application/json") resp, err := client.Do(req)