Skip to content

feat: add HTTP response compression middleware - #49

Merged
noneandundefined merged 47 commits into
mainfrom
feature/response-compression-47
Sep 20, 2026
Merged

noneandundefined merged 47 commits into
mainfrom
feature/response-compression-47

Conversation

@noneandundefined

@noneandundefined noneandundefined commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add provider-based HTTP response compression middleware with Accept-Encoding quality negotiation
  • include built-in gzip support in the standard libchttpx build through zlib
  • enable compression only at runtime through cHTTPX_CompressionUse(server, &config)
  • add configurable minimum size, compression level and MIME include/exclude policy
  • skip responses that should not be transformed (range, already encoded, no-transform, binary/precompressed MIME, etc.)
  • allow compression to be disabled per route or per response
  • add provider API designed for future Brotli/Zstandard implementations
  • add real HTTP gzip integration tests, provider failure coverage and gzip decompression verification
  • add CPU-vs-bandwidth benchmark, example and EN/RU documentation
  • add zlib to Linux packages, Docker, installers and Windows/Linux CI dependencies

Build and test

No separate compression build flag is required:

make libchttpx.so
make examples-compression
make test-compression
make benchmark-compression

Application code decides whether compression is enabled:

chttpx_compression_config_t compression = cHTTPX_CompressionDefault();
compression.min_size = 1024;
compression.level = 5;

cHTTPX_CompressionUse(server, &compression);

TLS remains independently optional:

make TLS=1 libchttpx.so

Closes #47

@github-actions github-actions Bot added documentation Improvements or additions to documentation ci core api packaging labels Sep 20, 2026
@noneandundefined
noneandundefined merged commit 9e1675c into main Sep 20, 2026
12 checks passed
@noneandundefined
noneandundefined deleted the feature/response-compression-47 branch September 20, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api ci core documentation Improvements or additions to documentation packaging scripts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: HTTP response compression middleware

1 participant