Просмотр исходного кода

fix(sub): set read/write/idle timeouts on the subscription server (#5360)

The public subscription http.Server set no timeouts, leaving the most exposed
listener open to slow-header/Slowloris exhaustion. Mirror the panel server
timeouts already used in internal/web/web.go.
n0ctal 1 день назад
Родитель
Сommit
118d1e4398
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      internal/sub/sub.go

+ 7 - 0
internal/sub/sub.go

@@ -297,6 +297,13 @@ func (s *Server) Start() (err error) {
 
 	s.httpServer = &http.Server{
 		Handler: engine,
+		// The subscription server is the most exposed (public) listener; without
+		// these a few slow-header connections exhaust it (Slowloris). Mirrors the
+		// panel server timeouts in internal/web/web.go.
+		ReadHeaderTimeout: 5 * time.Second,
+		ReadTimeout:       30 * time.Second,
+		WriteTimeout:      30 * time.Second,
+		IdleTimeout:       120 * time.Second,
 	}
 
 	go func() {