httpd: reuse the same compressor among bindings

This commit is contained in:
Nicola Murino 2021-02-04 22:32:55 +01:00
parent 267d9f1831
commit d32b195a57
No known key found for this signature in database
GPG key ID: 2F1FB59433D5A8CB

View file

@ -21,6 +21,8 @@ import (
"github.com/drakkan/sftpgo/version"
)
var compressor = middleware.NewCompressor(5)
type httpdServer struct {
binding Binding
staticFilesPath string
@ -398,7 +400,6 @@ func (s *httpdServer) initializeRouter() {
})
router.Group(func(router chi.Router) {
compressor := middleware.NewCompressor(5)
router.Use(compressor.Handler)
fileServer(router, webStaticFilesPath, http.Dir(s.staticFilesPath))
})