Skip to content

Commit cdd67a7

Browse files
authored
fix: 60s read header timeout on debugger (#290)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 09107db commit cdd67a7

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

cmd/cdnsd/main.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Blink Labs Software
1+
// Copyright 2025 Blink Labs Software
22
//
33
// Use of this source code is governed by an MIT-style
44
// license that can be found in the LICENSE file or at
@@ -11,10 +11,12 @@ import (
1111
"fmt"
1212
"log/slog"
1313
"net/http"
14-
_ "net/http/pprof"
1514
"os"
1615
"time"
1716

17+
// #nosec G108
18+
_ "net/http/pprof"
19+
1820
"github.com/prometheus/client_golang/prometheus/promhttp"
1921
"go.uber.org/automaxprocs/maxprocs"
2022

@@ -85,14 +87,15 @@ func main() {
8587
),
8688
)
8789
go func() {
88-
err := http.ListenAndServe(
89-
fmt.Sprintf(
90+
debugger := &http.Server{
91+
Addr: fmt.Sprintf(
9092
"%s:%d",
9193
cfg.Debug.ListenAddress,
9294
cfg.Debug.ListenPort,
9395
),
94-
nil,
95-
)
96+
ReadHeaderTimeout: 60 * time.Second,
97+
}
98+
err := debugger.ListenAndServe()
9699
if err != nil {
97100
slog.Error(
98101
fmt.Sprintf("failed to start debug listener: %s", err),

0 commit comments

Comments
 (0)