From f083763f1d7e0fd450f167db58f091310c8b2ec2 Mon Sep 17 00:00:00 2001 From: bel Date: Sun, 10 Mar 2024 11:17:48 -0600 Subject: [PATCH] there we go --- server/server.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/server.go b/server/server.go index e2a342c..4ffbfbc 100755 --- a/server/server.go +++ b/server/server.go @@ -153,11 +153,11 @@ func (s *Server) Pre(foo http.HandlerFunc) http.HandlerFunc { if auth, err := s.lookupAuth(mapKey(r.Host)); err != nil { log.Printf("failed to lookup auth for %s (%s): %v", r.Host, mapKey(r.Host), err) w.Header().Set("WWW-Authenticate", "Basic") - http.Error(w, err.Error(), http.StatusForbidden) + http.Error(w, err.Error(), http.StatusUnauthorized) } else if _, p, _ := r.BasicAuth(); auth != p { log.Printf("failed to auth: expected %q but got %q", auth, p) w.Header().Set("WWW-Authenticate", "Basic") - http.Error(w, "unexpected basic auth", http.StatusForbidden) + http.Error(w, "unexpected basic auth", http.StatusUnauthorized) } else { foo(w, r) } @@ -215,7 +215,6 @@ func (cb corsResponseWriter) WriteHeader(code int) { func doCORS(w http.ResponseWriter, r *http.Request) (http.ResponseWriter, bool) { key := mapKey(r.Host) if !config.GetCORS(key) { - pushMeta(r, "do-cors", "not enabled for key") return w, false } pushMeta(r, "do-cors", "enabled for key")