format + bump

This commit is contained in:
nemunaire 2018-09-18 22:16:58 +02:00
commit bd76956b46
7 changed files with 50 additions and 36 deletions

View file

@ -6,14 +6,14 @@ import (
"strings"
)
type imagesHandler struct{
type imagesHandler struct {
name string
auth func(*http.Request) (bool)
auth func(*http.Request) bool
hndlr http.Handler
getter func(fname string) (Picture, error)
}
func ImagesHandler(name string, auth func(*http.Request) (bool), hndlr http.Handler, getter func(fname string) (Picture, error)) (imagesHandler) {
func ImagesHandler(name string, auth func(*http.Request) bool, hndlr http.Handler, getter func(fname string) (Picture, error)) imagesHandler {
return imagesHandler{name, auth, hndlr, getter}
}
@ -39,7 +39,7 @@ func (i imagesHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
// Check rights
if ! i.auth(r) {
if !i.auth(r) {
w.Header().Set("WWW-Authenticate", "Basic realm=\"YouP0m\"")
http.Error(w, "You are not allowed to perform this request.", http.StatusUnauthorized)
return