nytimes / gziphandler

Go middleware to gzip HTTP responses
https://godoc.org/github.com/NYTimes/gziphandler
Apache License 2.0
868 stars 129 forks source link

Minimum size not compatible with template package #32

Closed alexandrestein closed 7 years ago

alexandrestein commented 7 years ago

The problem comes from the size limitation.

If the template package is used, it can calls Write multiple times with variable length. In any case the response writer must be the same for the all response inside the same request. So the package as is, is not good.

I made some modifications to prevent using different response writers on successive calls.

But the size limitation become pretty pointless with template or other handlers calling multiple times the Write function.

jprobinson commented 7 years ago

Looks like another recent PR may have caused some merge conflicts. Please clean those up and, if @adammck also gives blessing, I'll pull this in.

jprobinson commented 7 years ago

Yo, @adammck! Have a sec to put your :eyes: on this one? I'd like your 👌 before merging.

adammck commented 7 years ago

Sorry for the last-minute review, @jprobinson, but you did ask :smile: Feel free to dismiss if you'd prefer to get this merged and tidy things up later.

adammck commented 7 years ago

A bit heavy on the comments, but otherwise LGTM :+1: Thanks for the quick turnaround on those changes!