mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Fix gosec scan: G112 (CWE-400) Potential Slowloris Attack (#10872)
This commit is contained in:
@@ -52,7 +52,7 @@ func NewService(addr string, svcRegistry *runtime.ServiceRegistry, additionalHan
|
||||
mux.HandleFunc(h.Path, h.Handler)
|
||||
}
|
||||
|
||||
s.server = &http.Server{Addr: addr, Handler: mux}
|
||||
s.server = &http.Server{Addr: addr, Handler: mux, ReadHeaderTimeout: time.Second}
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package prometheus
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
)
|
||||
@@ -12,6 +13,6 @@ func RunSimpleServerOrDie(addr string) {
|
||||
mux := http.NewServeMux()
|
||||
mux.Handle("/metrics", promhttp.Handler())
|
||||
|
||||
svr := &http.Server{Addr: addr, Handler: mux}
|
||||
svr := &http.Server{Addr: addr, Handler: mux, ReadHeaderTimeout: time.Second}
|
||||
log.Fatal(svr.ListenAndServe())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user