mtrudel/bandit

Compression configuration options

kotsius opened this issue · 1 comments

Bandit compression seems to be working well, with both deflate and gzip. My understanding is that both are served by the zlib library, and that all Bandit does is pass a single set of parameters to Erlang.

However, the documentation is currently not clear regarding whether gzip compression is configurable. The deflate algorithm is common to deflate/zlib and gzip under the hood, and hence 'deflate_options' can actually refer to both formats. My testing shows that 'deflate_options: [level: #]' has an effect on response size when deflate applies, but no effect when gzip applies. If this is normal, it would help if it was documented.

The deflate_options config only affects deflate; there's no mechanism in the underlying :zlib library to configure the behaviour of gzip (see here for the specific place where the config is passed down to :zlib). I've updated Bandit's type docs on this on main; it'll go out in the next release.

Thanks for the note!