updated to code to enforce access rules to the control channel

This commit is contained in:
2025-01-31 21:20:10 +09:00
parent 148dfbcfe1
commit 16327fc576
2 changed files with 35 additions and 5 deletions

View File

@ -980,8 +980,11 @@ func (s *Server) wrap_http_handler(handler ServerHttpHandler) http.Handler {
status_code, realm = handler.Authenticate(req)
if status_code == http.StatusUnauthorized && realm != "" {
w.Header().Set("WWW-Authenticate", fmt.Sprintf("Basic Realm=\"%s\"", realm))
WriteEmptyRespHeader(w, status_code)
} else if status_code == http.StatusOK {
status_code, err = handler.ServeHTTP(w, req)
} else {
WriteEmptyRespHeader(w, status_code)
}
time_taken = time.Now().Sub(start_time)