{{ message }}
Repository navigation
Conversation
Add zstd as a third response encoding alongside gzip and Brotli,
mirrored through the same request-negotiation, config, header, and
static-precompression paths. Priority when several encodings are
acceptable: zstd > br > gzip.
Build:
* CMakeModules/FindZstd.cmake: detect libzstd via pkg-config or
find_path/find_library, requiring >= 1.4.0 for the streaming API.
* New WITH_ZSTD cache var (AUTO/ON/OFF, default AUTO); unlike
Brotli's manual toggle, this is a real auto-detect.
* Define USE_ZSTD and link libzstd when found (top-level, src/,
test/ CMakeLists.txt).
Core:
* util/zstdbuf.{h,cpp}: Compressor backed by libzstd's streaming
API, mirroring util/brotlibuf.{h,cpp}.
* http/httpreq.{h,cpp}: parse "zstd" from Accept-Encoding; add
ZSTD_ENABLED/REQ_ZSTD_ACCEPT/ZSTD_REQUIRED/UPSTREAM_ZSTD and
zstdAcceptable()/andZstd()/orZstd().
* http/httpserverconfig.{h,cpp}: get/setZstdCompress(),
get/setZstdCompressLevel().
* http/httpvhost.{h,cpp}: VH_ZSTD feature bit, enableZstd(), wired
to the per-vhost "enableZstd" directive.
* http/httprespheaders.{h,cpp}, httpresp.h: ETAG_ZSTD and
"content-encoding: zstd" header emission.
* http/staticfilecachedata.{h,cpp}: SFCD_MODE_ZSTD, ".lsq"
precompressed cache files; refactor tryCreateCompressed/
compressFile/readyCompressed/compressHelper from a brotli-only
bool onto an algo enum shared by all three codecs.
* http/staticfilehandler.cpp, sendfileinfo.cpp, subrequest.cpp:
include zstd in static-file mode selection and cache lookups.
* http/httpsession.cpp: factor zstd into compressibility checks
and the Content-Encoding strip/passthrough decision. Dynamic
(on-the-fly) bodies stay gzip-only via modgzip, same as Brotli.
* main/httpserver.cpp, plainconf.cpp: new directives
enableZstdCompress, zstdCompressLevel, zstdAutoUpdateStatic,
zstdStaticCompressLevel.
* config.h.in: add USE_ZSTD placeholder.
Tests:
* test/util/zstdbuftest.cpp: streaming round-trip test for
ZstdBuf, wired into src/ and test/ CMakeLists.txt.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add zstd as a third response encoding alongside gzip and Brotli, mirrored through the same request-negotiation, config, header, and static-precompression paths. Priority when several encodings are acceptable: zstd > br > gzip.
https://datatracker.ietf.org/doc/html/rfc8478
Build:
Core:
Tests: