mirror of
https://github.com/mattermost/mattermost.git
synced 2026-05-28 04:35:04 -04:00
[MM-45309] Replace github.com/mattermost/gziphandler with github.com/klauspost/compress/gzhttp (#24293)
This commit is contained in:
parent
eb35e83152
commit
e4fa6200c3
6 changed files with 19 additions and 24 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ require (
|
|||
github.com/isacikgoz/prompt v0.1.0
|
||||
github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056
|
||||
github.com/jmoiron/sqlx v1.3.5
|
||||
github.com/klauspost/compress v1.16.6
|
||||
github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80
|
||||
github.com/lib/pq v1.10.9
|
||||
github.com/mattermost/go-i18n v1.11.1-0.20211013152124-5c415071e404
|
||||
github.com/mattermost/gziphandler v0.0.1
|
||||
github.com/mattermost/logr/v2 v2.0.18
|
||||
github.com/mattermost/mattermost/server/public v0.0.9
|
||||
github.com/mattermost/morph v1.0.5-0.20230511171014-e76e25978d56
|
||||
|
|
@ -131,7 +131,6 @@ require (
|
|||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
|
||||
github.com/klauspost/compress v1.16.6 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
|
||||
github.com/klauspost/pgzip v1.2.6 // indirect
|
||||
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
|
||||
|
|
|
|||
|
|
@ -401,7 +401,6 @@ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:C
|
|||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||
github.com/klauspost/compress v1.11.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||
github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
|
||||
github.com/klauspost/compress v1.16.6 h1:91SKEy4K37vkp255cJ8QesJhjyRO0hn9i9G0GoUwLsk=
|
||||
github.com/klauspost/compress v1.16.6/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
|
|
@ -437,8 +436,6 @@ github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3v
|
|||
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mattermost/go-i18n v1.11.1-0.20211013152124-5c415071e404 h1:Khvh6waxG1cHc4Cz5ef9n3XVCxRWpAKUtqg9PJl5+y8=
|
||||
github.com/mattermost/go-i18n v1.11.1-0.20211013152124-5c415071e404/go.mod h1:RyS7FDNQlzF1PsjbJWHRI35exqaKGSO9qD4iv8QjE34=
|
||||
github.com/mattermost/gziphandler v0.0.1 h1:uXHcXF5agnQ6bXabvpiwwwZOlCYoa7mKHH0lxns/o8w=
|
||||
github.com/mattermost/gziphandler v0.0.1/go.mod h1:CvvZR7sXqhj81V2swXuQY7T04Ccc89u7W7pHNPKev8g=
|
||||
github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d h1:/RJ/UV7M5c7L2TQ0KNm4yZxxFvC1nvRz/gY/Daa35aI=
|
||||
github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d/go.mod h1:HLbgMEI5K131jpxGazJ97AxfPDt31osq36YS1oxFQPQ=
|
||||
github.com/mattermost/logr/v2 v2.0.18 h1:qiznuwwKckZJoGtBYc4Y9FAY97/oQwV1Pq9oO5qP5nk=
|
||||
|
|
|
|||
Loading…
Reference in a new issue