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

304 sends non empty body with gzip #66

Open
tedu opened this issue May 3, 2019 · 1 comment
Open

304 sends non empty body with gzip #66

tedu opened this issue May 3, 2019 · 1 comment

Comments

@tedu
Copy link

tedu commented May 3, 2019

304 responses should not have a body. However, when kcgi enables gzip, it compresses the empty body and responds with a 14 byte gzip header.

Probably shouldn't compress empty body regardless of response code.

@kristapsdz
Copy link
Owner

The Internet is really unhelpful dealing with this situation!

First, it's straightforward to make sure that gzflush() isn't called if no data was written, but zero-length content with gzip compression is technically invalid gzip, so empty content would be an error in this case. However, according to this thread, it might be technically correct after all...?

Meanwhile, you can force the issue with khttp_body_compress(0) with your 304s, which will disable compression for the call and have a zero-length body unless you, you know, wrote some data.

Seems like the best thing to do is to see what big servers are doing in this case (asking for compression and a 304). Do they 304 with gzip and zero content? Do they 304 without gzip?

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

No branches or pull requests

2 participants