content_encoding: ignore duplicate chunked encoding

- ignore duplicate "chunked" transfer-encodings from
  a server to accomodate for broken implementations
- add test1482 and test1483

Reported-by: Mel Zuser
Fixes #13451
Closes #13461
This commit is contained in:
Stefan Eissing 2024-04-24 11:11:11 +02:00 committed by Daniel Stenberg
parent 9fc4b2c78c
commit 886899143f
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 185 additions and 1 deletions

View file

@ -1009,6 +1009,13 @@ CURLcode Curl_build_unencoding_stack(struct Curl_easy *data,
}
cwt = find_unencode_writer(name, namelen, phase);
if(is_transfer && cwt && strncasecompare(name, "chunked", 7) &&
Curl_cwriter_get_by_type(data, cwt)) {
/* A 'chunked' transfer encoding has already been added.
* Ignore duplicates. See #13451. */
return CURLE_OK;
}
if(!cwt)
cwt = &error_writer; /* Defer error at use. */