feat: logging unauthenticated requests

This commit is contained in:
2026-05-06 01:36:44 +02:00
parent 5409281ec8
commit f51d2cc471
+1
View File
@@ -34,6 +34,7 @@ func main() {
u, p, ok := r.BasicAuth()
if !ok || subtle.ConstantTimeCompare([]byte(u), []byte(username)) != 1 ||
subtle.ConstantTimeCompare([]byte(p), []byte(password)) != 1 {
log.Printf("unauthorized request from %s", r.RemoteAddr)
w.Header().Set("WWW-Authenticate", `Basic realm="pz8-relay"`)
http.Error(w, "unauthorized", http.StatusUnauthorized)
return