chunked-encoding: stop hiding the CURLE_BAD_CONTENT_ENCODING error

Unknown content-encoding would get returned as CURLE_WRITE_ERROR if the
response is chunked-encoded.

Reported-by: Ilya Kosarev
Fixes #4310
Closes #4449
This commit is contained in:
Daniel Stenberg 2019-10-01 15:40:05 +02:00
parent ac830139da
commit f0f053fed0
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 39 additions and 24 deletions

View file

@ -776,14 +776,14 @@ static CURLcode readwrite_data(struct Curl_easy *data,
* and writes away the data. The returned 'nread' holds the number
* of actual data it wrote to the client.
*/
CURLcode extra;
CHUNKcode res =
Curl_httpchunk_read(conn, k->str, nread, &nread);
Curl_httpchunk_read(conn, k->str, nread, &nread, &extra);
if(CHUNKE_OK < res) {
if(CHUNKE_WRITE_ERROR == res) {
failf(data, "Failed writing data");
return CURLE_WRITE_ERROR;
if(CHUNKE_PASSTHRU_ERROR == res) {
failf(data, "Failed reading the chunked-encoded stream");
return extra;
}
failf(data, "%s in chunked-encoding", Curl_chunked_strerror(res));
return CURLE_RECV_ERROR;