fixed non-standard return code
This commit is contained in:
parent
888e1b9c7d
commit
32337f4bc8
@ -20,7 +20,7 @@ func BasicAuth(h http.Handler, htpasswd map[string]string, realm string) http.Ha
|
|||||||
user, pass, _ := r.BasicAuth()
|
user, pass, _ := r.BasicAuth()
|
||||||
if pw, ok := htpasswd[user]; !ok || !strings.EqualFold(pass, sha1(pw)) {
|
if pw, ok := htpasswd[user]; !ok || !strings.EqualFold(pass, sha1(pw)) {
|
||||||
w.Header().Set("WWW-Authenticate", rlm)
|
w.Header().Set("WWW-Authenticate", rlm)
|
||||||
http.Error(w, "Unauthorized", 401)
|
http.Error(w, "Unauthorized", http.StatusUnauthorized)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
h.ServeHTTP(w, r)
|
h.ServeHTTP(w, r)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user