mirror of
https://github.com/curl/curl.git
synced 2026-07-24 00:37:23 +03:00
content_encoding: brotli and others, pass through 0-length writes
- curl's transfer handling may write 0-length chunks at the end of the download with an EOS flag. (HTTP/2 does this commonly) - content encoders need to pass-through such a write and not count this as error in case they are finished decoding Fixes #13209 Fixes #13212 Closes #13219
This commit is contained in:
parent
6f32048200
commit
b30d694a02
4 changed files with 44 additions and 6 deletions
|
|
@ -300,7 +300,7 @@ static CURLcode deflate_do_write(struct Curl_easy *data,
|
|||
struct zlib_writer *zp = (struct zlib_writer *) writer;
|
||||
z_stream *z = &zp->z; /* zlib state structure */
|
||||
|
||||
if(!(type & CLIENTWRITE_BODY))
|
||||
if(!(type & CLIENTWRITE_BODY) || !nbytes)
|
||||
return Curl_cwriter_write(data, writer->next, type, buf, nbytes);
|
||||
|
||||
/* Set the compressed input when this function is called */
|
||||
|
|
@ -457,7 +457,7 @@ static CURLcode gzip_do_write(struct Curl_easy *data,
|
|||
struct zlib_writer *zp = (struct zlib_writer *) writer;
|
||||
z_stream *z = &zp->z; /* zlib state structure */
|
||||
|
||||
if(!(type & CLIENTWRITE_BODY))
|
||||
if(!(type & CLIENTWRITE_BODY) || !nbytes)
|
||||
return Curl_cwriter_write(data, writer->next, type, buf, nbytes);
|
||||
|
||||
if(zp->zlib_init == ZLIB_INIT_GZIP) {
|
||||
|
|
@ -669,7 +669,7 @@ static CURLcode brotli_do_write(struct Curl_easy *data,
|
|||
CURLcode result = CURLE_OK;
|
||||
BrotliDecoderResult r = BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT;
|
||||
|
||||
if(!(type & CLIENTWRITE_BODY))
|
||||
if(!(type & CLIENTWRITE_BODY) || !nbytes)
|
||||
return Curl_cwriter_write(data, writer->next, type, buf, nbytes);
|
||||
|
||||
if(!bp->br)
|
||||
|
|
@ -762,7 +762,7 @@ static CURLcode zstd_do_write(struct Curl_easy *data,
|
|||
ZSTD_outBuffer out;
|
||||
size_t errorCode;
|
||||
|
||||
if(!(type & CLIENTWRITE_BODY))
|
||||
if(!(type & CLIENTWRITE_BODY) || !nbytes)
|
||||
return Curl_cwriter_write(data, writer->next, type, buf, nbytes);
|
||||
|
||||
if(!zp->decomp) {
|
||||
|
|
@ -916,7 +916,7 @@ static CURLcode error_do_write(struct Curl_easy *data,
|
|||
(void) buf;
|
||||
(void) nbytes;
|
||||
|
||||
if(!(type & CLIENTWRITE_BODY))
|
||||
if(!(type & CLIENTWRITE_BODY) || !nbytes)
|
||||
return Curl_cwriter_write(data, writer->next, type, buf, nbytes);
|
||||
|
||||
failf(data, "Unrecognized content encoding type. "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue