tower-http icon indicating copy to clipboard operation
tower-http copied to clipboard

Support for larger sizes in `compression::predicate::SizeAbove`

Open liss-h opened this issue 5 months ago • 0 comments

  • [x] I have looked for existing issues (including closed) about this

Feature Request

Currently, SizeAbove has a u16 inside of it to limit the size where compression is active. It would be handy if a larger type (like u64) was used instead.

https://github.com/tower-rs/tower-http/blob/4bca529738aab78660d4d64a1da50dd2eb3c34b0/tower-http/src/compression/predicate.rs#L147-L149

Motivation

Since the size is in bytes 2^16 bytes is still quite small (64KiB), when the internet connection is fast enough it does not really make sense to compress payloads that small. So if you don't want to compress payloads that small you currently just have to reimplement the same thing, which is not ideal.

Proposal

Increase the type size from u16 to u64. There are no obvious drawbacks apparent for me. If you would like to make this change I can implement it if you want.

liss-h avatar Oct 02 '24 14:10 liss-h