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

Add Content-Length header for pre-compressed files #5

Closed duncanharris closed 4 years ago

duncanharris commented 4 years ago

We only set it when we know the whole file will be sent because no Range header was on the request. Otherwise we defer to the Range mechanics of the Go Standard library.

The rules are that Content-Length can be set with Content-Encoding but not with Transfer-Encoding.

The Go Standard library does not set Content-Length when Content-Encoding is set as a precautionary measure.

You can see as an example that Caddy does it.

lpar commented 4 years ago

Awesome, thanks!