diff --git a/api4/handlers.go b/api4/handlers.go index a08f9a465e..ff4e19d472 100644 --- a/api4/handlers.go +++ b/api4/handlers.go @@ -6,7 +6,7 @@ package api4 import ( "net/http" - "github.com/NYTimes/gziphandler" + "github.com/mattermost/gziphandler" "github.com/mattermost/mattermost-server/v5/web" ) diff --git a/go.mod b/go.mod index ce69f1ec1c..7f72738b8f 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,6 @@ require ( github.com/HdrHistogram/hdrhistogram-go v0.9.0 // indirect github.com/Masterminds/semver/v3 v3.1.1 github.com/Masterminds/squirrel v1.5.0 - github.com/NYTimes/gziphandler v1.1.1 github.com/PuerkitoBio/goquery v1.7.0 // indirect github.com/RoaringBitmap/roaring v0.8.0 // indirect github.com/advancedlogic/GoOse v0.0.0-20200830213114-1225d531e0ad // indirect @@ -61,7 +60,6 @@ require ( github.com/jaytaylor/html2text v0.0.0-20200412013138-3577fbdbcff7 github.com/jmoiron/sqlx v1.3.4 github.com/jonboulle/clockwork v0.2.2 - github.com/klauspost/compress v1.13.1 // indirect github.com/klauspost/cpuid/v2 v2.0.6 // indirect github.com/klauspost/pgzip v1.2.5 // indirect github.com/kr/pretty v0.2.0 // indirect @@ -72,6 +70,7 @@ require ( github.com/mattermost/go-i18n v1.11.0 github.com/mattermost/gorp v1.6.2-0.20210419141818-0904a6a388d3 github.com/mattermost/gosaml2 v0.3.3 + github.com/mattermost/gziphandler v0.0.1 github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d github.com/mattermost/logr v1.0.13 github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0 @@ -145,8 +144,6 @@ require ( willnorris.com/go/imageproxy v0.10.0 ) -replace github.com/NYTimes/gziphandler v1.1.1 => github.com/agnivade/gziphandler v1.1.2-0.20200815170021-7481835cb745 - replace github.com/dyatlov/go-opengraph => github.com/agnivade/go-opengraph v0.0.0-20201221052033-34e69ee2a627 // Hack to prevent the willf/bitset module from being upgraded to 1.2.0. diff --git a/go.sum b/go.sum index f27a14da5c..2bb2237b51 100644 --- a/go.sum +++ b/go.sum @@ -91,8 +91,6 @@ github.com/advancedlogic/GoOse v0.0.0-20200830213114-1225d531e0ad h1:gyzOmx++wVk github.com/advancedlogic/GoOse v0.0.0-20200830213114-1225d531e0ad/go.mod h1:f3HCSN1fBWjcpGtXyM119MJgeQl838v6so/PQOqvE1w= github.com/agnivade/go-opengraph v0.0.0-20201221052033-34e69ee2a627 h1:Z5Cd4rshcYMKhKuGaVeSaJ4sAiLHzB5YXF10+TvJDU4= github.com/agnivade/go-opengraph v0.0.0-20201221052033-34e69ee2a627/go.mod h1:4M/YtupetXsgPzt5YlR87whvFSHtYj1eBFUgcXiwrOY= -github.com/agnivade/gziphandler v1.1.2-0.20200815170021-7481835cb745 h1:K5MCP8PQt50Tqkcdtgg7jhYwo6VBJWMKUmgqbXdu7WE= -github.com/agnivade/gziphandler v1.1.2-0.20200815170021-7481835cb745/go.mod h1:eRIEzSVYGdp3PyjpBJPBPMo4LSeFUlpPjByDCzMRrtw= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -590,7 +588,6 @@ github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0 github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.10.10/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.10.11/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.13.1 h1:wXr2uRxZTJXHLly6qhJabee5JqIhTRoLBhDOA74hDEQ= github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= @@ -651,6 +648,8 @@ github.com/mattermost/gorp v1.6.2-0.20210419141818-0904a6a388d3 h1:VW5cRIZheMbcC github.com/mattermost/gorp v1.6.2-0.20210419141818-0904a6a388d3/go.mod h1:QCQ3U0M9T/BlAdjKFJo0I1oe/YAgbyjNdhU8bpOLafk= github.com/mattermost/gosaml2 v0.3.3 h1:ysWrjp08tpWmo6rV2MQ88Eag/Ttjuj91fZsvibF4/Tg= github.com/mattermost/gosaml2 v0.3.3/go.mod h1:Z429EIOiEi9kbq6yHoApfzlcXpa6dzRDc6pO+Vy2Ksk= +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 v1.0.13 h1:6F/fM3csvH6Oy5sUpJuW7YyZSzZZAhJm5VcgKMxA2P8= diff --git a/vendor/github.com/NYTimes/gziphandler/.travis.yml b/vendor/github.com/NYTimes/gziphandler/.travis.yml deleted file mode 100644 index 94dfae362d..0000000000 --- a/vendor/github.com/NYTimes/gziphandler/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: go -go: - - 1.x - - tip -env: - - GO111MODULE=on -install: - - go mod download -script: - - go test -race -v diff --git a/vendor/github.com/NYTimes/gziphandler/go.mod b/vendor/github.com/NYTimes/gziphandler/go.mod deleted file mode 100644 index b0eb97f993..0000000000 --- a/vendor/github.com/NYTimes/gziphandler/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module github.com/NYTimes/gziphandler - -go 1.11 - -require ( - github.com/klauspost/compress v1.10.11 - github.com/stretchr/testify v1.3.0 -) diff --git a/vendor/github.com/NYTimes/gziphandler/.gitignore b/vendor/github.com/mattermost/gziphandler/.gitignore similarity index 100% rename from vendor/github.com/NYTimes/gziphandler/.gitignore rename to vendor/github.com/mattermost/gziphandler/.gitignore diff --git a/vendor/github.com/mattermost/gziphandler/.golangci.yml b/vendor/github.com/mattermost/gziphandler/.golangci.yml new file mode 100644 index 0000000000..70b487c2f2 --- /dev/null +++ b/vendor/github.com/mattermost/gziphandler/.golangci.yml @@ -0,0 +1,48 @@ +run: + timeout: 5m + modules-download-mode: readonly + +linters-settings: + gofmt: + simplify: true + govet: + check-shadowing: true + disable-all: true + enable: + - asmdecl # report mismatches between assembly files and Go declarations + - assign # check for useless assignments + - atomic # check for common mistakes using the sync/atomic package + - bools # check for common mistakes involving boolean operators + - buildtag # check that +build tags are well-formed and correctly located + - cgocall # detect some violations of the cgo pointer passing rules + - composites # check for unkeyed composite literals + - copylocks # check for locks erroneously passed by value + - errorsas # report passing non-pointer or non-error values to errors.As + - httpresponse # check for mistakes using HTTP responses + - loopclosure # check references to loop variables from within nested functions + - lostcancel # check cancel func returned by context.WithCancel is called + - nilfunc # check for useless comparisons between functions and nil + - printf # check consistency of Printf format strings and arguments + - shift # check for shifts that equal or exceed the width of the integer + - stdmethods # check signature of methods of well-known interfaces + - structtag # check that struct field tags conform to reflect.StructTag.Get + - tests # check for common mistaken usages of tests and examples + - unmarshal # report passing non-pointer or non-interface values to unmarshal + - unreachable # check for unreachable code + - unsafeptr # check for invalid conversions of uintptr to unsafe.Pointer + - unusedresult # check for unused results of calls to some functions + +linters: + disable-all: true + enable: + - deadcode + - gofmt + - gosimple + - govet + - ineffassign + - scopelint + - structcheck + - staticcheck + - unconvert + - unused + - varcheck \ No newline at end of file diff --git a/vendor/github.com/NYTimes/gziphandler/CODE_OF_CONDUCT.md b/vendor/github.com/mattermost/gziphandler/CODE_OF_CONDUCT.md similarity index 100% rename from vendor/github.com/NYTimes/gziphandler/CODE_OF_CONDUCT.md rename to vendor/github.com/mattermost/gziphandler/CODE_OF_CONDUCT.md diff --git a/vendor/github.com/NYTimes/gziphandler/CONTRIBUTING.md b/vendor/github.com/mattermost/gziphandler/CONTRIBUTING.md similarity index 100% rename from vendor/github.com/NYTimes/gziphandler/CONTRIBUTING.md rename to vendor/github.com/mattermost/gziphandler/CONTRIBUTING.md diff --git a/vendor/github.com/NYTimes/gziphandler/LICENSE b/vendor/github.com/mattermost/gziphandler/LICENSE similarity index 100% rename from vendor/github.com/NYTimes/gziphandler/LICENSE rename to vendor/github.com/mattermost/gziphandler/LICENSE diff --git a/vendor/github.com/mattermost/gziphandler/Makefile b/vendor/github.com/mattermost/gziphandler/Makefile new file mode 100644 index 0000000000..28783aef1c --- /dev/null +++ b/vendor/github.com/mattermost/gziphandler/Makefile @@ -0,0 +1,23 @@ +.PHONY: build check-style install run test verify-gomod + +# Variables +GO=go + +# Test runs go test command +test: + $(GO) test -cover -race ./... + +# Checks code style by running golangci-lint on codebase. +check-style: + @if ! [ -x "$$(command -v golangci-lint)" ]; then \ + echo "golangci-lint is not installed. Please see https://github.com/golangci/golangci-lint#install for installation instructions."; \ + exit 1; \ + fi; \ + + @echo Running golangci-lint + golangci-lint run ./... + +# Check modules +verify-gomod: + $(GO) mod download + $(GO) mod verify diff --git a/vendor/github.com/NYTimes/gziphandler/README.md b/vendor/github.com/mattermost/gziphandler/README.md similarity index 71% rename from vendor/github.com/NYTimes/gziphandler/README.md rename to vendor/github.com/mattermost/gziphandler/README.md index 6259acaca7..517c89e15b 100644 --- a/vendor/github.com/NYTimes/gziphandler/README.md +++ b/vendor/github.com/mattermost/gziphandler/README.md @@ -6,9 +6,12 @@ response body, for clients which support it. Although it's usually simpler to leave that to a reverse proxy (like nginx or Varnish), this package is useful when that's undesirable. +**This is forked from the original repo at https://github.com/nytimes/gziphandler +with this [PR](https://github.com/nytimes/gziphandler/pull/107) included.** + ## Install ```bash -go get -u github.com/NYTimes/gziphandler +go get -u github.com/mattermost/gziphandler ``` ## Usage @@ -23,7 +26,7 @@ package main import ( "io" "net/http" - "github.com/NYTimes/gziphandler" + "github.com/mattermost/gziphandler" ) func main() { @@ -52,5 +55,5 @@ The docs can be found at [godoc.org][docs], as usual. -[docs]: https://godoc.org/github.com/NYTimes/gziphandler -[license]: https://github.com/NYTimes/gziphandler/blob/master/LICENSE +[docs]: https://godoc.org/github.com/mattermost/gziphandler +[license]: https://github.com/mattermost/gziphandler/blob/master/LICENSE diff --git a/vendor/github.com/mattermost/gziphandler/go.mod b/vendor/github.com/mattermost/gziphandler/go.mod new file mode 100644 index 0000000000..abf7293471 --- /dev/null +++ b/vendor/github.com/mattermost/gziphandler/go.mod @@ -0,0 +1,8 @@ +module github.com/mattermost/gziphandler + +go 1.11 + +require ( + github.com/klauspost/compress v1.13.1 + github.com/stretchr/testify v1.3.0 +) diff --git a/vendor/github.com/NYTimes/gziphandler/go.sum b/vendor/github.com/mattermost/gziphandler/go.sum similarity index 69% rename from vendor/github.com/NYTimes/gziphandler/go.sum rename to vendor/github.com/mattermost/gziphandler/go.sum index da2e0003aa..2624700006 100644 --- a/vendor/github.com/NYTimes/gziphandler/go.sum +++ b/vendor/github.com/mattermost/gziphandler/go.sum @@ -1,7 +1,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/klauspost/compress v1.10.11 h1:K9z59aO18Aywg2b/WSgBaUX99mHy2BES18Cr5lBKZHk= -github.com/klauspost/compress v1.10.11/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/klauspost/compress v1.13.1 h1:wXr2uRxZTJXHLly6qhJabee5JqIhTRoLBhDOA74hDEQ= +github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/vendor/github.com/NYTimes/gziphandler/gzip.go b/vendor/github.com/mattermost/gziphandler/gzip.go similarity index 98% rename from vendor/github.com/NYTimes/gziphandler/gzip.go rename to vendor/github.com/mattermost/gziphandler/gzip.go index 0143bae8da..c32490ce42 100644 --- a/vendor/github.com/NYTimes/gziphandler/gzip.go +++ b/vendor/github.com/mattermost/gziphandler/gzip.go @@ -1,4 +1,4 @@ -package gziphandler // import "github.com/NYTimes/gziphandler" +package gziphandler // import "github.com/mattermost/gziphandler" import ( "bufio" @@ -94,7 +94,7 @@ type GzipResponseWriterWithCloseNotify struct { } func (w GzipResponseWriterWithCloseNotify) CloseNotify() <-chan bool { - return w.ResponseWriter.(http.CloseNotifier).CloseNotify() + return w.ResponseWriter.(http.CloseNotifier).CloseNotify() //nolint:staticcheck } // Write appends data to the gzip writer. @@ -332,7 +332,7 @@ func GzipHandlerWithOpts(opts ...option) (func(http.Handler) http.Handler, error } defer gw.Close() - if _, ok := w.(http.CloseNotifier); ok { + if _, ok := w.(http.CloseNotifier); ok { //nolint:staticcheck gwcn := GzipResponseWriterWithCloseNotify{gw} h.ServeHTTP(gwcn, r) } else { diff --git a/vendor/github.com/NYTimes/gziphandler/gzip_go18.go b/vendor/github.com/mattermost/gziphandler/gzip_go18.go similarity index 100% rename from vendor/github.com/NYTimes/gziphandler/gzip_go18.go rename to vendor/github.com/mattermost/gziphandler/gzip_go18.go diff --git a/vendor/modules.txt b/vendor/modules.txt index 1bac99a7b8..4f5e9d311d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -13,9 +13,6 @@ github.com/Masterminds/semver/v3 # github.com/Masterminds/squirrel v1.5.0 ## explicit github.com/Masterminds/squirrel -# github.com/NYTimes/gziphandler v1.1.1 => github.com/agnivade/gziphandler v1.1.2-0.20200815170021-7481835cb745 -## explicit -github.com/NYTimes/gziphandler # github.com/PuerkitoBio/goquery v1.7.0 ## explicit github.com/PuerkitoBio/goquery @@ -343,7 +340,6 @@ github.com/josharian/intern # github.com/json-iterator/go v1.1.11 github.com/json-iterator/go # github.com/klauspost/compress v1.13.1 -## explicit github.com/klauspost/compress/flate github.com/klauspost/compress/fse github.com/klauspost/compress/gzip @@ -394,6 +390,9 @@ github.com/mattermost/gorp github.com/mattermost/gosaml2 github.com/mattermost/gosaml2/types github.com/mattermost/gosaml2/uuid +# github.com/mattermost/gziphandler v0.0.1 +## explicit +github.com/mattermost/gziphandler # github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d ## explicit github.com/mattermost/ldap diff --git a/web/handlers.go b/web/handlers.go index a577b678c9..96864ce2f6 100644 --- a/web/handlers.go +++ b/web/handlers.go @@ -14,7 +14,7 @@ import ( "strings" "time" - "github.com/NYTimes/gziphandler" + "github.com/mattermost/gziphandler" "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" spanlog "github.com/opentracing/opentracing-go/log" diff --git a/web/static.go b/web/static.go index 4d8b8d31df..7600ee32ac 100644 --- a/web/static.go +++ b/web/static.go @@ -9,7 +9,7 @@ import ( "path/filepath" "strings" - "github.com/NYTimes/gziphandler" + "github.com/mattermost/gziphandler" "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/shared/mlog"