From 32337f4bc8f000dd7bab658bb87bcad5ddbc09c9 Mon Sep 17 00:00:00 2001 From: Colin Henry Date: Wed, 14 Sep 2022 15:41:15 -0700 Subject: [PATCH] fixed non-standard return code --- net/http/auth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/http/auth.go b/net/http/auth.go index 29c1851..7068ef8 100644 --- a/net/http/auth.go +++ b/net/http/auth.go @@ -20,7 +20,7 @@ func BasicAuth(h http.Handler, htpasswd map[string]string, realm string) http.Ha user, pass, _ := r.BasicAuth() if pw, ok := htpasswd[user]; !ok || !strings.EqualFold(pass, sha1(pw)) { w.Header().Set("WWW-Authenticate", rlm) - http.Error(w, "Unauthorized", 401) + http.Error(w, "Unauthorized", http.StatusUnauthorized) return } h.ServeHTTP(w, r)