format + bump
This commit is contained in:
parent
4febf49b3e
commit
bd76956b46
7 changed files with 50 additions and 36 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue