[MM-45309] Replace github.com/mattermost/gziphandler with github.com/klauspost/compress/gzhttp (#24293)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
eb35e83152
Коммит
e4fa6200c3
@@ -6,7 +6,7 @@ package api4
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/mattermost/gziphandler"
|
||||
"github.com/klauspost/compress/gzhttp"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
@@ -32,7 +32,7 @@ func (api *API) APIHandler(h handlerFunc) http.Handler {
|
||||
IsLocal: false,
|
||||
}
|
||||
if *api.srv.Config().ServiceSettings.WebserverMode == "gzip" {
|
||||
return gziphandler.GzipHandler(handler)
|
||||
return gzhttp.GzipHandler(handler)
|
||||
}
|
||||
return handler
|
||||
}
|
||||
@@ -51,7 +51,7 @@ func (api *API) APISessionRequired(h handlerFunc) http.Handler {
|
||||
IsLocal: false,
|
||||
}
|
||||
if *api.srv.Config().ServiceSettings.WebserverMode == "gzip" {
|
||||
return gziphandler.GzipHandler(handler)
|
||||
return gzhttp.GzipHandler(handler)
|
||||
}
|
||||
return handler
|
||||
}
|
||||
@@ -70,7 +70,7 @@ func (api *API) CloudAPIKeyRequired(h handlerFunc) http.Handler {
|
||||
IsLocal: false,
|
||||
}
|
||||
if *api.srv.Config().ServiceSettings.WebserverMode == "gzip" {
|
||||
return gziphandler.GzipHandler(handler)
|
||||
return gzhttp.GzipHandler(handler)
|
||||
}
|
||||
return handler
|
||||
}
|
||||
@@ -90,7 +90,7 @@ func (api *API) RemoteClusterTokenRequired(h handlerFunc) http.Handler {
|
||||
IsLocal: false,
|
||||
}
|
||||
if *api.srv.Config().ServiceSettings.WebserverMode == "gzip" {
|
||||
return gziphandler.GzipHandler(handler)
|
||||
return gzhttp.GzipHandler(handler)
|
||||
}
|
||||
return handler
|
||||
}
|
||||
@@ -110,7 +110,7 @@ func (api *API) APISessionRequiredMfa(h handlerFunc) http.Handler {
|
||||
IsLocal: false,
|
||||
}
|
||||
if *api.srv.Config().ServiceSettings.WebserverMode == "gzip" {
|
||||
return gziphandler.GzipHandler(handler)
|
||||
return gzhttp.GzipHandler(handler)
|
||||
}
|
||||
return handler
|
||||
}
|
||||
@@ -130,7 +130,7 @@ func (api *API) APIHandlerTrustRequester(h handlerFunc) http.Handler {
|
||||
IsLocal: false,
|
||||
}
|
||||
if *api.srv.Config().ServiceSettings.WebserverMode == "gzip" {
|
||||
return gziphandler.GzipHandler(handler)
|
||||
return gzhttp.GzipHandler(handler)
|
||||
}
|
||||
return handler
|
||||
}
|
||||
@@ -149,7 +149,7 @@ func (api *API) APISessionRequiredTrustRequester(h handlerFunc) http.Handler {
|
||||
IsLocal: false,
|
||||
}
|
||||
if *api.srv.Config().ServiceSettings.WebserverMode == "gzip" {
|
||||
return gziphandler.GzipHandler(handler)
|
||||
return gzhttp.GzipHandler(handler)
|
||||
}
|
||||
return handler
|
||||
}
|
||||
@@ -169,7 +169,7 @@ func (api *API) APISessionRequiredDisableWhenBusy(h handlerFunc) http.Handler {
|
||||
DisableWhenBusy: true,
|
||||
}
|
||||
if *api.srv.Config().ServiceSettings.WebserverMode == "gzip" {
|
||||
return gziphandler.GzipHandler(handler)
|
||||
return gzhttp.GzipHandler(handler)
|
||||
}
|
||||
return handler
|
||||
}
|
||||
@@ -191,7 +191,7 @@ func (api *API) APILocal(h handlerFunc) http.Handler {
|
||||
}
|
||||
|
||||
if *api.srv.Config().ServiceSettings.WebserverMode == "gzip" {
|
||||
return gziphandler.GzipHandler(handler)
|
||||
return gzhttp.GzipHandler(handler)
|
||||
}
|
||||
return handler
|
||||
}
|
||||
|
||||
@@ -658,7 +658,7 @@ func getPostThread(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
fromPost := r.URL.Query().Get("fromPost")
|
||||
// Either only fromCreateAt must be set, or both fromPost and fromCreateAt must be set
|
||||
if fromPost != "" && fromCreateAt == 0 {
|
||||
c.SetInvalidParam("if fromPost is set, then fromCreatAt must also be set")
|
||||
c.SetInvalidParam("if fromPost is set, then fromCreateAt must also be set")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -14,12 +14,11 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/klauspost/compress/gzhttp"
|
||||
"github.com/opentracing/opentracing-go"
|
||||
"github.com/opentracing/opentracing-go/ext"
|
||||
spanlog "github.com/opentracing/opentracing-go/log"
|
||||
|
||||
"github.com/mattermost/gziphandler"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
"github.com/mattermost/mattermost/server/public/shared/i18n"
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
@@ -474,7 +473,7 @@ func (w *Web) APIHandler(h func(*Context, http.ResponseWriter, *http.Request)) h
|
||||
IsLocal: false,
|
||||
}
|
||||
if *w.srv.Config().ServiceSettings.WebserverMode == "gzip" {
|
||||
return gziphandler.GzipHandler(handler)
|
||||
return gzhttp.GzipHandler(handler)
|
||||
}
|
||||
return handler
|
||||
}
|
||||
@@ -494,7 +493,7 @@ func (w *Web) APIHandlerTrustRequester(h func(*Context, http.ResponseWriter, *ht
|
||||
IsLocal: false,
|
||||
}
|
||||
if *w.srv.Config().ServiceSettings.WebserverMode == "gzip" {
|
||||
return gziphandler.GzipHandler(handler)
|
||||
return gzhttp.GzipHandler(handler)
|
||||
}
|
||||
return handler
|
||||
}
|
||||
@@ -513,7 +512,7 @@ func (w *Web) APISessionRequired(h func(*Context, http.ResponseWriter, *http.Req
|
||||
IsLocal: false,
|
||||
}
|
||||
if *w.srv.Config().ServiceSettings.WebserverMode == "gzip" {
|
||||
return gziphandler.GzipHandler(handler)
|
||||
return gzhttp.GzipHandler(handler)
|
||||
}
|
||||
return handler
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/mattermost/gziphandler"
|
||||
"github.com/klauspost/compress/gzhttp"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
@@ -39,8 +39,8 @@ func (w *Web) InitStatic() {
|
||||
pluginHandler := staticFilesHandler(http.StripPrefix(path.Join(subpath, "static", "plugins"), http.FileServer(http.Dir(*w.srv.Config().PluginSettings.ClientDirectory))))
|
||||
|
||||
if *w.srv.Config().ServiceSettings.WebserverMode == "gzip" {
|
||||
staticHandler = gziphandler.GzipHandler(staticHandler)
|
||||
pluginHandler = gziphandler.GzipHandler(pluginHandler)
|
||||
staticHandler = gzhttp.GzipHandler(staticHandler)
|
||||
pluginHandler = gzhttp.GzipHandler(pluginHandler)
|
||||
}
|
||||
|
||||
w.MainRouter.PathPrefix("/static/plugins/").Handler(pluginHandler)
|
||||
|
||||
Ссылка в новой задаче
Block a user