mirror of
https://github.com/lukaszraczylo/traefikoidc.git
synced 2026-10-18 04:47:28 +00:00
refactor(oidcgate): WriteTimeout for slowloris guard, nolint reason
This commit is contained in:
@@ -25,17 +25,18 @@ func buildMux(cfg *Config, middleware http.Handler, ready readyReporter) *http.S
|
|||||||
}
|
}
|
||||||
|
|
||||||
// buildServer wraps the mux in an http.Server with sensible timeouts.
|
// buildServer wraps the mux in an http.Server with sensible timeouts.
|
||||||
func buildServer(cfg *Config, mux http.Handler) *http.Server { //nolint:unused
|
func buildServer(cfg *Config, mux http.Handler) *http.Server { //nolint:unused // consumed by main.go in Task 9
|
||||||
return &http.Server{
|
return &http.Server{
|
||||||
Addr: cfg.Listen,
|
Addr: cfg.Listen,
|
||||||
Handler: mux,
|
Handler: mux,
|
||||||
ReadHeaderTimeout: 10 * time.Second,
|
ReadHeaderTimeout: 10 * time.Second,
|
||||||
|
WriteTimeout: 30 * time.Second,
|
||||||
IdleTimeout: 120 * time.Second,
|
IdleTimeout: 120 * time.Second,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// shutdown gracefully stops the server with a 15s deadline.
|
// shutdown gracefully stops the server with a 15s deadline.
|
||||||
func shutdown(srv *http.Server) error { //nolint:unused
|
func shutdown(srv *http.Server) error { //nolint:unused // consumed by main.go in Task 9
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
return srv.Shutdown(ctx)
|
return srv.Shutdown(ctx)
|
||||||
|
|||||||
Reference in New Issue
Block a user