lpar / gzipped

Replacement for golang http.FileServer which supports precompressed static assets.
BSD 3-Clause "New" or "Revised" License
94 stars 15 forks source link

Fix content encoding header being set to "identity" #12

Closed hhromic closed 4 years ago

hhromic commented 4 years ago

The actual problem was the case of serving an identity file without any compressed siblings.

For example if the content directory contains:

file.txt
file.txt.gz
file2.txt

The last case was incorrect behaviour, response should have no content-encoding header.

The fileserve test code was fixed and improved to cover for this case.

Fixes #10

hhromic commented 4 years ago

@lpar thanks for merging this PR. I can confirm now that combining lpar/gzipped with nytimes/gziphandler in a hierarchy of handlers works perfectly in version v2.0.2.

Any file request that does not have a pre-compressed file on disk served by lpar/gzipped can be compressed on-the-fly with nytimes/gziphandler just by chaining these two modules.