1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-26 15:07:42 +02:00

Select compression algorithm using features flags (#2250)

Add compress-* feature flags in actix-http / actix-web / awc.
This allow enable / disable not wanted compression algorithm.
This commit is contained in:
Arthur Le Moigne
2021-06-19 21:21:13 +02:00
committed by GitHub
parent c260fb1c48
commit baa5a663c4
19 changed files with 204 additions and 72 deletions

View File

@ -17,7 +17,7 @@ edition = "2018"
[package.metadata.docs.rs]
# features that docs.rs will build with
features = ["openssl", "rustls", "compress", "cookies", "secure-cookies"]
features = ["openssl", "rustls", "compress-brotli", "compress-gzip", "compress-zstd", "cookies", "secure-cookies"]
[lib]
name = "actix_web"
@ -39,10 +39,14 @@ members = [
# resolver = "2"
[features]
default = ["compress", "cookies"]
default = ["compress-brotli", "compress-gzip", "compress-zstd", "cookies"]
# content-encoding support
compress = ["actix-http/compress"]
# Brotli algorithm content-encoding support
compress-brotli = ["actix-http/compress-brotli", "__compress"]
# Gzip and deflate algorithms content-encoding support
compress-gzip = ["actix-http/compress-gzip", "__compress"]
# Zstd algorithm content-encoding support
compress-zstd = ["actix-http/compress-zstd", "__compress"]
# support for cookies
cookies = ["cookie"]
@ -56,6 +60,10 @@ openssl = ["actix-http/openssl", "actix-tls/accept", "actix-tls/openssl"]
# rustls
rustls = ["actix-http/rustls", "actix-tls/accept", "actix-tls/rustls"]
# Internal (PRIVATE!) features used to aid testing and cheking feature status.
# Don't rely on these whatsoever. They may disappear at anytime.
__compress = []
[dependencies]
actix-codec = "0.4.0"
actix-macros = "0.2.1"
@ -71,6 +79,7 @@ actix-http = "3.0.0-beta.7"
ahash = "0.7"
bytes = "1"
cfg-if = "1"
cookie = { version = "0.15", features = ["percent-encode"], optional = true }
derive_more = "0.99.5"
either = "1.5.3"
@ -126,15 +135,15 @@ awc = { path = "awc" }
[[test]]
name = "test_server"
required-features = ["compress", "cookies"]
required-features = ["compress-brotli", "compress-gzip", "compress-zstd", "cookies"]
[[example]]
name = "basic"
required-features = ["compress"]
required-features = ["compress-gzip"]
[[example]]
name = "uds"
required-features = ["compress"]
required-features = ["compress-gzip"]
[[example]]
name = "on_connect"