You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Client configured to use Zstd will try to decompress non-Zstd responses #483
When enabling Zstd compression, the Clickhouse client will add the accept-encoding: zstd header to tell the server that it can accept Zstd encoded bodies. However, HTTP defines this as a suggestion, so the server or any proxy in the middle does not have to comply.
In my case, I use Cloudflare as a proxy, which seems to not apply compression because the response is already small (87 bytes), but Clickhouse unconditionally tries to decompress the payload with Zstd, which fails due to it not being compressed:
let stream = Decompress::new(stream, compression);
Steps to reproduce
Create a client with compression mode Compression::Zstd(_)
Run a SELECT query against a clickhouse server with a proxy in-between that does not compress the response with Zstd
The query errors with decompression error: Unknown frame descriptor
Expected behaviour
Clickhouse client should check the Content-Encoding header in the response and use the value in the header to decide whether the response is compressed, instead of assuming it's always Zstd.
Code example
let client = clickhouse::Client::default()
// ... credential setup omitted ...
.with_compression(clickhouse::Compression::zstd());
client.query("SELECT * FROM table").fetch_all().await?;
Great news! I've coincidentally fixed this in #482 as well since it now chooses the decoder based on the Content-Encoding header, because I foresaw this exact kind of issue 🤣.
Activity
abonander commentedon Sep 30, 2026
Great news! I've coincidentally fixed this in #482 as well since it now chooses the decoder based on the
Content-Encodingheader, because I foresaw this exact kind of issue 🤣.