security fix: Uncontrolled resource consumption (Slowloris)
This commit is contained in:
parent
b3b102b2f4
commit
499e251796
|
@ -58,8 +58,12 @@ func NewApp(cfg *settings.Settings, baseURL string, bind string) App {
|
||||||
|
|
||||||
func (app *App) Start() {
|
func (app *App) Start() {
|
||||||
app.srv = &http.Server{
|
app.srv = &http.Server{
|
||||||
Addr: app.bind,
|
Addr: app.bind,
|
||||||
Handler: app.router,
|
Handler: app.router,
|
||||||
|
ReadHeaderTimeout: 15 * time.Second,
|
||||||
|
ReadTimeout: 15 * time.Second,
|
||||||
|
WriteTimeout: 10 * time.Second,
|
||||||
|
IdleTimeout: 30 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Ready, listening on %s\n", app.bind)
|
log.Printf("Ready, listening on %s\n", app.bind)
|
||||||
|
|
|
@ -52,8 +52,12 @@ func NewApp(htpasswd_file *string, restrict_to_ips *string, baseURL string, bind
|
||||||
|
|
||||||
func (app *App) Start() {
|
func (app *App) Start() {
|
||||||
app.srv = &http.Server{
|
app.srv = &http.Server{
|
||||||
Addr: app.bind,
|
Addr: app.bind,
|
||||||
Handler: app.router,
|
Handler: app.router,
|
||||||
|
ReadHeaderTimeout: 15 * time.Second,
|
||||||
|
ReadTimeout: 15 * time.Second,
|
||||||
|
WriteTimeout: 10 * time.Second,
|
||||||
|
IdleTimeout: 30 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Ready, listening on %s\n", app.bind)
|
log.Printf("Ready, listening on %s\n", app.bind)
|
||||||
|
|
|
@ -104,7 +104,11 @@ func main() {
|
||||||
signal.Notify(interrupt, os.Interrupt, syscall.SIGTERM)
|
signal.Notify(interrupt, os.Interrupt, syscall.SIGTERM)
|
||||||
|
|
||||||
srv := &http.Server{
|
srv := &http.Server{
|
||||||
Addr: *bind,
|
Addr: *bind,
|
||||||
|
ReadHeaderTimeout: 15 * time.Second,
|
||||||
|
ReadTimeout: 15 * time.Second,
|
||||||
|
WriteTimeout: 10 * time.Second,
|
||||||
|
IdleTimeout: 30 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
http.HandleFunc("/enqueue", enqueueHandler)
|
http.HandleFunc("/enqueue", enqueueHandler)
|
||||||
|
|
|
@ -50,8 +50,12 @@ func NewApp(baseURL string) App {
|
||||||
|
|
||||||
func (app *App) Start(bind string) {
|
func (app *App) Start(bind string) {
|
||||||
app.srv = &http.Server{
|
app.srv = &http.Server{
|
||||||
Addr: bind,
|
Addr: bind,
|
||||||
Handler: app.router,
|
Handler: app.router,
|
||||||
|
ReadHeaderTimeout: 15 * time.Second,
|
||||||
|
ReadTimeout: 15 * time.Second,
|
||||||
|
WriteTimeout: 10 * time.Second,
|
||||||
|
IdleTimeout: 30 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
if err := app.srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
||||||
|
|
|
@ -88,7 +88,11 @@ func main() {
|
||||||
signal.Notify(interrupt, os.Interrupt, syscall.SIGTERM)
|
signal.Notify(interrupt, os.Interrupt, syscall.SIGTERM)
|
||||||
|
|
||||||
srv := &http.Server{
|
srv := &http.Server{
|
||||||
Addr: *bind,
|
Addr: *bind,
|
||||||
|
ReadHeaderTimeout: 15 * time.Second,
|
||||||
|
ReadTimeout: 15 * time.Second,
|
||||||
|
WriteTimeout: 10 * time.Second,
|
||||||
|
IdleTimeout: 30 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Serve pages
|
// Serve pages
|
||||||
|
|
Loading…
Reference in New Issue