Skip to content

Commit

Permalink
Fix GO-S2114 security issue
Browse files Browse the repository at this point in the history
  • Loading branch information
deluan committed Sep 27, 2022
1 parent a7a0e23 commit 2a3cd08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions consts/consts.go
Expand Up @@ -41,6 +41,8 @@ const (
RequestThrottleBacklogLimit = 100
RequestThrottleBacklogTimeout = time.Minute

ServerReadHeaderTimeout = 3 * time.Second

ArtistInfoTimeToLive = 24 * time.Hour

I18nFolder = "i18n"
Expand Down
7 changes: 6 additions & 1 deletion server/server.go
Expand Up @@ -45,7 +45,12 @@ var startTime = time.Now()
func (s *Server) Run(addr string) error {
s.MountRouter("WebUI", consts.URLPathUI, s.frontendAssetsHandler())
log.Info("Navidrome server is ready!", "address", addr, "startupTime", time.Since(startTime))
return http.ListenAndServe(addr, s.router)
server := &http.Server{
Addr: addr,
ReadHeaderTimeout: consts.ServerReadHeaderTimeout,
}

return server.ListenAndServe()
}

func (s *Server) initRoutes() {
Expand Down

0 comments on commit 2a3cd08

Please sign in to comment.