spreadshirt / gorilla-handlers-double-gzip-bug

This is a minimal working example to demonstrate the gorilla/handlers.CompressHandlers gzips twice.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

This is a minimal working example to demonstrate the gorilla/handlers.CompressHandlers gzips twice.

License:MIT License


Languages

Language:Go 100.0%