Skip to content

fix(actix): use gzip level 1 instead of default level 6#148

Open
BennyFranciscus wants to merge 1 commit intomainfrom
fix/actix-gzip-level-1
Open

fix(actix): use gzip level 1 instead of default level 6#148
BennyFranciscus wants to merge 1 commit intomainfrom
fix/actix-gzip-level-1

Conversation

@BennyFranciscus
Copy link
Copy Markdown
Collaborator

Fixes #73

actix-web's Compress::default() middleware uses gzip level 6, but the benchmark spec requires level 1.

This PR updates the /compression handler to manually compress using flate2::write::GzEncoder with Compression::fast() (level 1) and sets the Content-Encoding: gzip header so the Compress middleware skips re-compressing the response.

Changes:

  • Added flate2 = "1" dependency to frameworks/actix/Cargo.toml
  • Updated the compression() handler in main.rs to manually gzip at level 1

The Compress middleware uses gzip level 6 by default, but the benchmark
spec requires level 1. Manually compress with flate2 Compression::fast()
(level 1) in the compression handler and set Content-Encoding: gzip so
the middleware skips re-compressing.
@BennyFranciscus
Copy link
Copy Markdown
Collaborator Author

CI still hitting the port 8080 infrastructure issue — server didn't start within 30s. The build itself is fine (all Docker layers cached), it's the stale container blocking the port on the runner.

Can't retrigger from my side since the branch has push protection. Could you re-run the failed job when you get a chance? The code change is just a one-liner (gzip level 6 → 1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Audit] actix: /compression uses default gzip level (6) instead of required level 1

1 participant