0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-30 22:34:18 -05:00

cmd/imageproxy: add proper server timeouts

This commit is contained in:
Will Norris 2022-11-08 17:04:39 -08:00
parent e4a58965b2
commit 59aad26e29

View file

@ -90,15 +90,20 @@ func main() {
p.Verbose = *verbose
p.UserAgent = *userAgent
server := &http.Server{
Addr: *addr,
Handler: p,
}
r := mux.NewRouter().SkipClean(true).UseEncodedPath()
r.PathPrefix("/").Handler(p)
server := &http.Server{
Addr: *addr,
Handler: r,
ReadTimeout: 10 * time.Second,
WriteTimeout: 30 * time.Second,
IdleTimeout: 120 * time.Second,
}
fmt.Printf("imageproxy listening on %s\n", server.Addr)
log.Fatal(http.ListenAndServe(*addr, r))
log.Fatal(server.ListenAndServe())
}
type signatureKeyList [][]byte