(w http.ResponseWriter, r *http.Request)
| 157 | } |
| 158 | |
| 159 | func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
| 160 | if auth.AllowedWithAuth(h.am, r, auth.OpAll) { |
| 161 | h.serveHTTP(w, r) |
| 162 | return |
| 163 | } |
| 164 | if us, ok := h.am.(auth.UnauthorizedSender); ok { |
| 165 | if us.SendUnauthorized(w, r) { |
| 166 | return |
| 167 | } |
| 168 | } |
| 169 | w.Header().Set("WWW-Authenticate", "Basic realm=scanning cabinet") |
| 170 | w.WriteHeader(http.StatusUnauthorized) |
| 171 | fmt.Fprintf(w, "<html><body><h1>Unauthorized</h1>") |
| 172 | } |
| 173 | |
| 174 | func (h *handler) serveHTTP(w http.ResponseWriter, r *http.Request) { |
| 175 | if h.mux == nil { |
no test coverage detected