Use forked version of gziphandler (#17852)

Этот коммит содержится в:
Agniva De Sarker
2021-06-30 14:39:28 +05:30
коммит произвёл GitHub
родитель f8fc5190ee
Коммит 97e3c550a4
19 изменённых файлов: 101 добавлений и 41 удалений

10
vendor/github.com/NYTimes/gziphandler/.travis.yml сгенерированный поставляемый
Просмотреть файл

@@ -1,10 +0,0 @@
language: go
go:
- 1.x
- tip
env:
- GO111MODULE=on
install:
- go mod download
script:
- go test -race -v

8
vendor/github.com/NYTimes/gziphandler/go.mod сгенерированный поставляемый
Просмотреть файл

@@ -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
)

Просмотреть файл

48
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

Просмотреть файл

Просмотреть файл

Просмотреть файл

23
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

Просмотреть файл

@@ -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

8
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
)

Просмотреть файл

@@ -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=

Просмотреть файл

@@ -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 {

Просмотреть файл