tide-compress

Crates.iotide-compress
lib.rstide-compress
version0.11.0
sourcesrc
created_at2020-05-23 18:02:43.304987
updated_at2023-01-16 20:04:48.327229
descriptionOutgoing compression middleware for the Tide server framework.
homepage
repositoryhttps://github.com/Fishrock123/tide-compress
max_upload_size
id244946
size87,065
Jeremiah Senkpiel (Fishrock123)

documentation

README

tide-compress on crates.io Documentation (latest release)

tide-compress

Outgoing body compression middleware for the Tide server framework.

#[async_std::main]
async fn main() {
    let mut app = tide::new();
    app.with(tide_compress::CompressMiddleware::new());
}

Features

  • Support for Brotli, Gzip, and Deflate encodings, compile-time configurable through cargo feature flags.
    • Prioritizes Brotli if available.
    • Only pulls in the necessary dependencies for the desired configuration.
    • Defaults to Brotli & Gzip.
    • Also handles the "identity" encoding directive as per RFC 9110.
  • Accept-Encoding header checking including priority.
  • Minimum body size threshold (Default: 1024 bytes, configurable).
  • Does not compress responses with a Cache-Control: no-transform header.
  • Sets the Vary header.
  • Checks the Content-Type header (MIME).
    • Checks against jshttp's comprehensive database, which is compiled to a perfect hash function.
    • The database can be regenerated in the crate's repository by running cargo run generate-database.
    • If not in the database, checks against a regular expression.
      • Default: ^text/|\+(?:json|text|xml)$ (case insensitive).
      • Fully override-able to any custom Regex, with None as an option.
    • Functionality can be excluded in crate features if the regex crate poses build issues.

License

Licensed under the BlueOak Model License 1.0.0Contributions via DCO 1.1

Commit count: 121

cargo fmt