Skip to content
This is a minimal working example to demonstrate the gorilla/handlers.CompressHandlers gzips twice.
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
go.mod
go.sum
main.go

README.md

Minimal example for double gzip by gorilla/handlers.CompressHandler

The CompressHandler of gorilla/handlers gzips responses twice if they're already gzipped, i.e. it ignores the Content-Encoding header.

How to reproduce

Requirements:

  • go 1.12+
$ go run main.go &
$ curl -H 'Accept-Encoding: gzip' localhost:9999 | gunzip
# prints garbage
$ curl -H 'Accept-Encoding: gzip' localhost:9999 | gunzip | gunzip
# works fine

A working implementation is served on localhost:19999.

You can’t perform that action at this time.