changed handling of images slightly

This commit is contained in:
Julian Daube 2017-03-31 14:43:01 +02:00
parent 29b7e17323
commit ddf4b8fad5

View File

@ -104,6 +104,7 @@ func (h Handler) Picture(resp http.ResponseWriter, path []string) {
InternalError(resp) InternalError(resp)
return return
} }
defer img.Close()
decodedImg, err := jpeg.Decode(img) decodedImg, err := jpeg.Decode(img)
if err != nil { if err != nil {
@ -260,5 +261,8 @@ func main() {
} }
log.Println("start serving on:", *addr) log.Println("start serving on:", *addr)
log.Fatal(http.ListenAndServe(*addr, Handler{conn, cache.New(cache.NoExpiration, 0)})) log.Fatal(http.ListenAndServe(*addr, Handler{
Connection: conn,
cache: cache.New(cache.NoExpiration, 0),
}))
} }