From 05c9eb66698b459c0e13fe593d70450efdd41e7b Mon Sep 17 00:00:00 2001 From: eleksir Date: Fri, 27 Mar 2026 13:22:57 +0300 Subject: [PATCH] Do not configure tls options if we running in plain http mode, without encryption --- internal/backer/newServer.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/backer/newServer.go b/internal/backer/newServer.go index 92c8fe0..19bd473 100644 --- a/internal/backer/newServer.go +++ b/internal/backer/newServer.go @@ -99,6 +99,17 @@ func NewServer(configPath string) (*http.Server, error) { log.Infof("Backup completed: client=%s user=%s files=%d bytes=%d duration=%s", clientIP, username, len(files), bytesWritten, duration) }) + // Decision about which mode (http or https) to run made in cmd/backer/main.go, where we run server.ListenAndServe() + // or server.ListenAndServeTLS() depending on value of C.NoHTTPS. + if C.NoHTTPS { + return &http.Server{ + Addr: fmt.Sprintf("%s:%d", C.Address, C.Port), + Handler: withServerHeader(mux), + ReadHeaderTimeout: 5 * time.Second, + WriteTimeout: time.Duration(C.BackupTimeout) * time.Minute, + }, nil + } + return &http.Server{ Addr: fmt.Sprintf("%s:%d", C.Address, C.Port), Handler: withServerHeader(mux),