MCPcopy
hub / github.com/perkeep/perkeep / ServeHTTP

Method ServeHTTP

app/scanningcabinet/handler.go:159–172  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

157}
158
159func (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
174func (h *handler) serveHTTP(w http.ResponseWriter, r *http.Request) {
175 if h.mux == nil {

Callers 1

serveHTTPMethod · 0.45

Calls 5

serveHTTPMethod · 0.95
AllowedWithAuthFunction · 0.92
SendUnauthorizedMethod · 0.80
SetMethod · 0.65
WriteHeaderMethod · 0.45

Tested by

no test coverage detected