]> granicus.if.org Git - curl/commitdiff
content_encoding: do not write 0 length data
authorPatrick Monnerat <patrick@monnerat.net>
Tue, 7 Nov 2017 01:38:34 +0000 (02:38 +0100)
committerPatrick Monnerat <patrick@monnerat.net>
Tue, 7 Nov 2017 01:38:34 +0000 (02:38 +0100)
lib/content_encoding.c

index 6b31685735ffabdc212666c58dec6ddadb80e130..904dff526c5cd0fa14e25162e24bb019792db8c8 100644 (file)
@@ -573,8 +573,6 @@ static CURLcode brotli_unencode_write(struct connectdata *conn,
   size_t dstleft;
   CURLcode result = CURLE_OK;
 
-  if(!nbytes)
-    return CURLE_OK;
   if(!bp->br)
     return CURLE_WRITE_ERROR;  /* Stream already ended. */
 
@@ -826,6 +824,8 @@ static contenc_writer *new_unencoding_writer(struct connectdata *conn,
 CURLcode Curl_unencode_write(struct connectdata *conn, contenc_writer *writer,
                              const char *buf, size_t nbytes)
 {
+  if(!nbytes)
+    return CURLE_OK;
   return writer->handler->unencode_write(conn, writer, buf, nbytes);
 }