Skip to content

Commit 9f60a87

Browse files
anjannathpraveenkumar
authored andcommitted
Remove Read and Write timeout from the daemon API server
the timeouts were added in b38b9ef to fix golangci_lint errors, however since we have some long running operations such as '/start', '/stop' and '/delete' which takes more then 10 seconds to finish, it ends up with io error this commit removes the ReadTimeout and WriteTimeout and instead set the ReadHeaderTimeout for the server setting ReadHeaderTimeout should prevent slowloris attacks as reported by golangci_lint
1 parent 0fb95f4 commit 9f60a87

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

cmd/crc/cmd/daemon.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,8 @@ func run(configuration *types.Configuration) error {
147147
mux.Handle("/api/", http.StripPrefix("/api", api.NewMux(config, machineClient, logging.Memory, segmentClient)))
148148
mux.Handle("/socket/", http.StripPrefix("/socket", websocket.NewWebsocketServer(machineClient)))
149149
s := &http.Server{
150-
Handler: handlers.LoggingHandler(os.Stderr, mux),
151-
ReadTimeout: 10 * time.Second,
152-
WriteTimeout: 10 * time.Second,
150+
Handler: handlers.LoggingHandler(os.Stderr, mux),
151+
ReadHeaderTimeout: 10 * time.Second,
153152
}
154153
if err := s.Serve(listener); err != nil {
155154
errCh <- errors.Wrap(err, "api http.Serve failed")

0 commit comments

Comments
 (0)