From 4b235564569ffc0711264974cb3017a9e90df758 Mon Sep 17 00:00:00 2001 From: jinnrry Date: Sun, 13 Aug 2023 14:56:40 +0800 Subject: [PATCH] v2.0.1 --- server/http_server/http_server.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/server/http_server/http_server.go b/server/http_server/http_server.go index 676207d..1ad9ef4 100644 --- a/server/http_server/http_server.go +++ b/server/http_server/http_server.go @@ -27,6 +27,12 @@ func HttpStart() { if config.Instance.HttpsEnabled != 2 { mux.HandleFunc("/", controllers.Interceptor) + httpServer = &http.Server{ + Addr: fmt.Sprintf(":%d", HttpPort), + Handler: mux, + ReadTimeout: time.Second * 60, + WriteTimeout: time.Second * 60, + } } else { fe, err := fs.Sub(local, "dist") if err != nil { @@ -42,13 +48,12 @@ func HttpStart() { mux.HandleFunc("/api/settings/modify_password", contextIterceptor(controllers.ModifyPassword)) mux.HandleFunc("/attachments/", contextIterceptor(controllers.GetAttachments)) mux.HandleFunc("/attachments/download/", contextIterceptor(controllers.Download)) - } - - httpServer = &http.Server{ - Addr: fmt.Sprintf(":%d", HttpPort), - Handler: session.Instance.LoadAndSave(mux), - ReadTimeout: time.Second * 60, - WriteTimeout: time.Second * 60, + httpServer = &http.Server{ + Addr: fmt.Sprintf(":%d", HttpPort), + Handler: session.Instance.LoadAndSave(mux), + ReadTimeout: time.Second * 60, + WriteTimeout: time.Second * 60, + } } err := httpServer.ListenAndServe()