Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 11, 2019

Conversation

duncanharris
Copy link
Contributor

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.

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.
Also set the Vary header when setting Content-Encoding.

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.
@lpar lpar merged commit fb2330b into lpar:master Nov 11, 2019
@lpar
Copy link
Owner

lpar commented Nov 11, 2019

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants