reyk / httpd

OpenBSD httpd
Other
313 stars 31 forks source link

Support serving gzipped files #64

Closed i80and closed 7 years ago

i80and commented 8 years ago

This patch adds a serve_gzip configuration option that allows serving file.gz as file with Content-Encoding: gzip if the client advertises that it accepts said encoding.

To keep it simple, serve_gzip is conservative, and does not serve gzip at all if Accept-Encoding: gzip specifies a qvalue[1] (because q=0 is possible). If desired, I can implement qvalue parsing.

Vary: Accept-Encoding is currently added unconditionally, but it might make sense to only add it if the serve_gzip configuration option is given.

EDIT: Optional second commit adds support for serving Brotli files as well.

reyk commented 8 years ago

Thanks for the diff. We carefully have to consider if we'd want to include such functionality.

i80and commented 8 years ago

Noted. I was worried this would be considered featuritis, so absolutely don't take this if you're not comfortable with it.