CompressHandler gzip's twice
klingtnet opened this issue · 6 comments
klingtnet commented
The CompressHandler
of [gorilla/handlers][1] gzips responses twice if they're already gzipped, i.e. it ignores the Content-Encoding
header.
Here's a minimal working example:
package main
import (
"fmt"
"net/http"
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
func main() {
r := mux.NewRouter()
r.Handle("/", promhttp.Handler())
r.Use(handlers.CompressHandler)
fmt.Println("Listening on :9999")
http.ListenAndServe(":9999", r)
}
klingtnet commented
A repository with the minimal working example and instructions on how to reproduce it can be found here: https://github.com/spreadshirt/gorilla-handlers-double-gzip-bug
elithrar commented
Happy to take a PR that prevents this.
…On Thu, Apr 4, 2019 at 6:55 AM Andreas Linz ***@***.***> wrote:
The CompressHandler of [gorilla/handlers][1] gzips responses twice if
they're already gzipped, i.e. it ignores the Content-Encoding header.
Here's a minimal working example:
package main
import (
"fmt"
"net/http"
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
func main() {
r := mux.NewRouter()
r.Handle("/", promhttp.Handler())
r.Use(handlers.CompressHandler)
fmt.Println("Listening on :9999")
http.ListenAndServe(":9999", r)
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#153>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABIcF8ZpnHP6LjZVU4Ate-Gl5AgP1sFks5vdgRZgaJpZM4cc3Yb>
.
klingtnet commented
I'm on it.
stale commented
This issue has been automatically marked as stale because it hasn't seen a recent update. It'll be automatically closed in a few days.
klingtnet commented
This message is to keep the issue from being closed automatically.