mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-25 09:00:27 +00:00
parent
a219d25cac
commit
17a42a0c11
1 changed files with 5 additions and 2 deletions
|
@ -14,6 +14,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-chi/chi/middleware"
|
||||||
"github.com/rs/cors"
|
"github.com/rs/cors"
|
||||||
"github.com/rs/xid"
|
"github.com/rs/xid"
|
||||||
"golang.org/x/net/webdav"
|
"golang.org/x/net/webdav"
|
||||||
|
@ -37,9 +38,10 @@ type webDavServer struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *webDavServer) listenAndServe() error {
|
func (s *webDavServer) listenAndServe() error {
|
||||||
|
compressor := middleware.NewCompressor(5, "text/*")
|
||||||
|
handler := compressor.Handler(s)
|
||||||
httpServer := &http.Server{
|
httpServer := &http.Server{
|
||||||
Addr: s.binding.GetAddress(),
|
Addr: s.binding.GetAddress(),
|
||||||
Handler: s,
|
|
||||||
ReadHeaderTimeout: 30 * time.Second,
|
ReadHeaderTimeout: 30 * time.Second,
|
||||||
IdleTimeout: 120 * time.Second,
|
IdleTimeout: 120 * time.Second,
|
||||||
MaxHeaderBytes: 1 << 16, // 64KB
|
MaxHeaderBytes: 1 << 16, // 64KB
|
||||||
|
@ -55,8 +57,9 @@ func (s *webDavServer) listenAndServe() error {
|
||||||
AllowCredentials: s.config.Cors.AllowCredentials,
|
AllowCredentials: s.config.Cors.AllowCredentials,
|
||||||
OptionsPassthrough: true,
|
OptionsPassthrough: true,
|
||||||
})
|
})
|
||||||
httpServer.Handler = c.Handler(s)
|
handler = c.Handler(handler)
|
||||||
}
|
}
|
||||||
|
httpServer.Handler = handler
|
||||||
if certMgr != nil && s.binding.EnableHTTPS {
|
if certMgr != nil && s.binding.EnableHTTPS {
|
||||||
serviceStatus.Bindings = append(serviceStatus.Bindings, s.binding)
|
serviceStatus.Bindings = append(serviceStatus.Bindings, s.binding)
|
||||||
httpServer.TLSConfig = &tls.Config{
|
httpServer.TLSConfig = &tls.Config{
|
||||||
|
|
Loading…
Reference in a new issue