From 6ad2fba45a278bdb10334e438a34d23c60c85abf Mon Sep 17 00:00:00 2001 From: renovate <renovate-bot@autistici.org> Date: Thu, 12 Oct 2023 09:41:17 +0000 Subject: [PATCH] Update module github.com/lpar/gzipped/v2 to v2.1.0 --- go.mod | 2 +- go.sum | 2 ++ .../github.com/lpar/gzipped/v2/.gitattributes | 1 + vendor/github.com/lpar/gzipped/v2/.travis.yml | 13 ++++++++ vendor/github.com/lpar/gzipped/v2/README.md | 10 ++++--- .../github.com/lpar/gzipped/v2/filesystem.go | 28 +++++++++++++++--- vendor/github.com/lpar/gzipped/v2/go.mod | 6 ++-- vendor/github.com/lpar/gzipped/v2/go.sum | 3 -- .../lpar/gzipped/v2/testdata/file.txt | 1 + .../lpar/gzipped/v2/testdata/file.txt.gz | Bin 0 -> 47 bytes .../lpar/gzipped/v2/testdata/file2.txt | 1 + vendor/modules.txt | 2 +- 12 files changed, 52 insertions(+), 17 deletions(-) create mode 100644 vendor/github.com/lpar/gzipped/v2/.gitattributes create mode 100644 vendor/github.com/lpar/gzipped/v2/.travis.yml create mode 100644 vendor/github.com/lpar/gzipped/v2/testdata/file.txt create mode 100644 vendor/github.com/lpar/gzipped/v2/testdata/file.txt.gz create mode 100644 vendor/github.com/lpar/gzipped/v2/testdata/file2.txt diff --git a/go.mod b/go.mod index 50bbc810..599170a9 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/google/subcommands v1.2.0 github.com/jmcvetta/randutil v0.0.0-20150817122601-2bb1b664bcff github.com/kevinpollet/nego v0.0.0-20201213172553-d6ce2e30cfd6 // indirect - github.com/lpar/gzipped/v2 v2.0.2 + github.com/lpar/gzipped/v2 v2.1.0 github.com/miekg/dns v1.1.45 github.com/prometheus/client_golang v1.11.0 github.com/prometheus/common v0.32.1 diff --git a/go.sum b/go.sum index 6afbb04d..d45802df 100644 --- a/go.sum +++ b/go.sum @@ -350,6 +350,8 @@ github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-b github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/lpar/gzipped/v2 v2.0.2 h1:y7FjyTH07f8dX0YQ5o0sg2DTbRnmS3oT1pUvxViQ//o= github.com/lpar/gzipped/v2 v2.0.2/go.mod h1:qb7pLOGFgqz5w9xGGiiRFPxuGZ7GqWEuXUKXSbgonkQ= +github.com/lpar/gzipped/v2 v2.1.0 h1:87/ug239roEqXLVOnXZg6NjDfFvMwmkGTKnFWJPUA9U= +github.com/lpar/gzipped/v2 v2.1.0/go.mod h1:G3UlFoFYzjCx6NV4zDmD1BIWMNBaJuKoUvxrEWJuZ3Y= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= diff --git a/vendor/github.com/lpar/gzipped/v2/.gitattributes b/vendor/github.com/lpar/gzipped/v2/.gitattributes new file mode 100644 index 00000000..fa1385d9 --- /dev/null +++ b/vendor/github.com/lpar/gzipped/v2/.gitattributes @@ -0,0 +1 @@ +* -text diff --git a/vendor/github.com/lpar/gzipped/v2/.travis.yml b/vendor/github.com/lpar/gzipped/v2/.travis.yml new file mode 100644 index 00000000..f7a8f5c0 --- /dev/null +++ b/vendor/github.com/lpar/gzipped/v2/.travis.yml @@ -0,0 +1,13 @@ +language: go + +go: + - 1.x + +before_install: + - go get -t -v ./... + +script: + - go test -race -coverprofile=coverage.txt -covermode=atomic + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/lpar/gzipped/v2/README.md b/vendor/github.com/lpar/gzipped/v2/README.md index 6c55f14f..b1cebd08 100644 --- a/vendor/github.com/lpar/gzipped/v2/README.md +++ b/vendor/github.com/lpar/gzipped/v2/README.md @@ -1,4 +1,6 @@ [](https://godoc.org/github.com/lpar/gzipped) +[](https://travis-ci.org/lpar/gzipped) +[](https://codecov.io/gh/lpar/gzipped) # gzipped.FileServer @@ -65,21 +67,21 @@ Accept-Encoding headers properly, and has unit tests. ## Caveats All requests are passed to Go's standard `http.ServeContent` method for -fulfilment. MIME type sniffing, accept ranges, content negotiation and other -tricky details are handled by that method. +fulfilment. MIME type mapping, accept ranges, content negotiation and other +tricky details are handled by that method. If the extension of a file doesn't have a defined MIME type, `ServeContent`'s sniffing may result in it assigning a MIME type such as `application/x-gzip` rather than what you might hope. See issue #18 for more information. It is up to you to ensure that your compressed and uncompressed resources are kept in sync. Directory browsing isn't supported. That includes remapping URLs ending in `/` to `index.html`, -`index.htm`, `Welcome.html` or whatever -- if you want URLs remapped that way, +`index.htm`, `Welcome.html` or whatever — if you want URLs remapped that way, I suggest having your router do it, or using middleware, so that you have control over the behavior. For example, to add support for `index.html` files in directories: ```go func withIndexHTML(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if strings.HasSuffix(r.URL.Path, "/") { + if strings.HasSuffix(r.URL.Path, "/") || len(r.URL.Path) == 0 { newpath := path.Join(r.URL.Path, "index.html") r.URL.Path = newpath } diff --git a/vendor/github.com/lpar/gzipped/v2/filesystem.go b/vendor/github.com/lpar/gzipped/v2/filesystem.go index 2faa408e..4f268e26 100644 --- a/vendor/github.com/lpar/gzipped/v2/filesystem.go +++ b/vendor/github.com/lpar/gzipped/v2/filesystem.go @@ -1,6 +1,7 @@ package gzipped import ( + fs2 "io/fs" "net/http" "os" "path" @@ -29,13 +30,32 @@ func (d Dir) Exists(name string) bool { } fullName := filepath.Join(dir, filepath.FromSlash(path.Clean("/"+name))) _, err := os.Stat(fullName) - if err != nil { - return false - } - return true + return err == nil } // Open defers to http.Dir's Open so that gzipped.Dir implements http.FileSystem. func (d Dir) Open(name string) (http.File, error) { return http.Dir(d).Open(name) } + +func FS(f fs2.FS) FileSystem { + return fs{fs: f} +} + +type fs struct { + fs fs2.FS +} + +// Exists tests whether a file with the specified name exists, resolved relative to the file system. +func (f fs) Exists(name string) bool { + if filepath.Separator != '/' && strings.ContainsRune(name, filepath.Separator) { + return false + } + _, err := fs2.Stat(f.fs, strings.TrimPrefix(filepath.FromSlash(path.Clean(name)), "/")) + return err == nil +} + +// Open defers to http.FS's Open so that gzipped.fs implements http.FileSystem. +func (f fs) Open(name string) (http.File, error) { + return http.FS(f.fs).Open(strings.TrimPrefix(name, "/")) +} diff --git a/vendor/github.com/lpar/gzipped/v2/go.mod b/vendor/github.com/lpar/gzipped/v2/go.mod index 2723db02..0a424450 100644 --- a/vendor/github.com/lpar/gzipped/v2/go.mod +++ b/vendor/github.com/lpar/gzipped/v2/go.mod @@ -1,7 +1,5 @@ module github.com/lpar/gzipped/v2 -require ( - github.com/kevinpollet/nego v0.0.0-20200324111829-b3061ca9dd9d -) +require github.com/kevinpollet/nego v0.0.0-20200324111829-b3061ca9dd9d -go 1.13 +go 1.18 diff --git a/vendor/github.com/lpar/gzipped/v2/go.sum b/vendor/github.com/lpar/gzipped/v2/go.sum index bf153be6..28393a64 100644 --- a/vendor/github.com/lpar/gzipped/v2/go.sum +++ b/vendor/github.com/lpar/gzipped/v2/go.sum @@ -2,14 +2,11 @@ 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/kevinpollet/nego v0.0.0-20200324111829-b3061ca9dd9d h1:BaIpmhcqpBnz4+NZjUjVGxKNA+/E7ovKsjmwqjXcGYc= github.com/kevinpollet/nego v0.0.0-20200324111829-b3061ca9dd9d/go.mod h1:3FSWkzk9h42opyV0o357Fq6gsLF/A6MI/qOca9kKobY= -github.com/lpar/accept v0.1.0 h1:q4+k1TJuCfoe8cIBRLTfiMMoiaHKpn1rlD1yYE/wj7o= -github.com/lpar/accept v0.1.0/go.mod h1:/ZcJqAhzugu4J4EZ7hwixKslL0y07dMxQzIZZLpbZbk= 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= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/lpar/gzipped/v2/testdata/file.txt b/vendor/github.com/lpar/gzipped/v2/testdata/file.txt new file mode 100644 index 00000000..e1993644 --- /dev/null +++ b/vendor/github.com/lpar/gzipped/v2/testdata/file.txt @@ -0,0 +1 @@ +zyxwvutsrqponmlkjihgfedcba diff --git a/vendor/github.com/lpar/gzipped/v2/testdata/file.txt.gz b/vendor/github.com/lpar/gzipped/v2/testdata/file.txt.gz new file mode 100644 index 0000000000000000000000000000000000000000..c3cc069a60a682045d28f9ae3ea4221ffb4bb872 GIT binary patch literal 47 zcmb2|=3oE;CT4FRFF#LT@AD_loH}>%>}h=s9W6agUG4QN);wZj`1H=ZU7CS`0RUgS B5HtV) literal 0 HcmV?d00001 diff --git a/vendor/github.com/lpar/gzipped/v2/testdata/file2.txt b/vendor/github.com/lpar/gzipped/v2/testdata/file2.txt new file mode 100644 index 00000000..db38b549 --- /dev/null +++ b/vendor/github.com/lpar/gzipped/v2/testdata/file2.txt @@ -0,0 +1 @@ +1234567890987654321 diff --git a/vendor/modules.txt b/vendor/modules.txt index 9a1dc6d9..a0e46a32 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -58,7 +58,7 @@ github.com/json-iterator/go # github.com/kevinpollet/nego v0.0.0-20201213172553-d6ce2e30cfd6 ## explicit github.com/kevinpollet/nego -# github.com/lpar/gzipped/v2 v2.0.2 +# github.com/lpar/gzipped/v2 v2.1.0 ## explicit github.com/lpar/gzipped/v2 # github.com/matttproud/golang_protobuf_extensions v1.0.1 -- GitLab