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

Close gzip Writer before putting back into pool #6

Closed ryanfowler closed 9 years ago

ryanfowler commented 9 years ago

When using:

defer gzw.Close()

The gzip.Writer was being closed after being put back into the pool of writers.

As per: https://golang.org/pkg/compress/gzip/#Writer.Close, calling Close flushes any unwritten data to the underlying io.Writer. This should happen before being placed back into the pool to be used by another connection.

adammck commented 9 years ago

Good grief! We should have updated this when we introduced the pool. Thanks for the fix.

ryanfowler commented 9 years ago

No problem, thanks for open sourcing!