content_encoding: fix limit failure message

The message triggered earlier than intended and did not take the
transfer/content type into account.

Ref #21603
Reported-by: Joshua Rogers
Closes #21756
This commit is contained in:
Stefan Eissing 2026-05-26 15:27:22 +02:00 committed by Daniel Stenberg
parent a8e6f90a69
commit 049ec8a363
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 6 additions and 5 deletions

View file

@ -750,9 +750,10 @@ CURLcode Curl_build_unencoding_stack(struct Curl_easy *data,
return CURLE_OK;
}
if(Curl_cwriter_count(data, phase) + 1 >= MAX_ENCODE_STACK) {
failf(data, "Reject response due to more than %d content encodings",
MAX_ENCODE_STACK);
if(Curl_cwriter_count(data, phase) >= MAX_ENCODE_STACK) {
failf(data, "Reject response exceeding limit of %d %s encodings",
MAX_ENCODE_STACK,
is_transfer ? "transfer" : "content");
return CURLE_BAD_CONTENT_ENCODING;
}