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:
parent
e4a58965b2
commit
59aad26e29
1 changed files with 11 additions and 6 deletions
|
@ -90,15 +90,20 @@ func main() {
|
||||||
p.Verbose = *verbose
|
p.Verbose = *verbose
|
||||||
p.UserAgent = *userAgent
|
p.UserAgent = *userAgent
|
||||||
|
|
||||||
server := &http.Server{
|
|
||||||
Addr: *addr,
|
|
||||||
Handler: p,
|
|
||||||
}
|
|
||||||
|
|
||||||
r := mux.NewRouter().SkipClean(true).UseEncodedPath()
|
r := mux.NewRouter().SkipClean(true).UseEncodedPath()
|
||||||
r.PathPrefix("/").Handler(p)
|
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)
|
fmt.Printf("imageproxy listening on %s\n", server.Addr)
|
||||||
log.Fatal(http.ListenAndServe(*addr, r))
|
log.Fatal(server.ListenAndServe())
|
||||||
}
|
}
|
||||||
|
|
||||||
type signatureKeyList [][]byte
|
type signatureKeyList [][]byte
|
||||||
|
|
Loading…
Reference in a new issue