summaryrefslogtreecommitdiffstats
path: root/lib/http_chunks.c
diff options
context:
space:
mode:
authorCurl Upstream <curl-library@cool.haxx.se>2018-01-23 21:49:00 (GMT)
committerBrad King <brad.king@kitware.com>2018-01-24 19:14:23 (GMT)
commitaf9e654045f11028e50dac4781e297834129a749 (patch)
tree028fac729d317112e5790204712f4b4c7985a0de /lib/http_chunks.c
parentde7c21d677db1ddaeece03c19e13e448f4031511 (diff)
downloadCMake-af9e654045f11028e50dac4781e297834129a749.zip
CMake-af9e654045f11028e50dac4781e297834129a749.tar.gz
CMake-af9e654045f11028e50dac4781e297834129a749.tar.bz2
curl 2018-01-23 (d6c21c8e)
Code extracted from: https://github.com/curl/curl.git at commit d6c21c8eec597a925d2b647cff3d58ac69de01a0 (curl-7_58_0).
Diffstat (limited to 'lib/http_chunks.c')
-rw-r--r--lib/http_chunks.c42
1 files changed, 5 insertions, 37 deletions
diff --git a/lib/http_chunks.c b/lib/http_chunks.c
index 92d7731..1616429 100644
--- a/lib/http_chunks.c
+++ b/lib/http_chunks.c
@@ -187,49 +187,17 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
piece = curlx_sotouz((ch->datasize >= length)?length:ch->datasize);
/* Write the data portion available */
-#ifdef HAVE_LIBZ
- switch(conn->data->set.http_ce_skip?
- IDENTITY : data->req.auto_decoding) {
- case IDENTITY:
-#endif
- if(!k->ignorebody) {
- if(!data->set.http_te_skip)
- result = Curl_client_write(conn, CLIENTWRITE_BODY, datap,
- piece);
- else
- result = CURLE_OK;
- }
-#ifdef HAVE_LIBZ
- break;
-
- case DEFLATE:
- /* update data->req.keep.str to point to the chunk data. */
- data->req.str = datap;
- result = Curl_unencode_deflate_write(conn, &data->req,
- (ssize_t)piece);
- break;
-
- case GZIP:
- /* update data->req.keep.str to point to the chunk data. */
- data->req.str = datap;
- result = Curl_unencode_gzip_write(conn, &data->req,
- (ssize_t)piece);
- break;
-
- default:
- failf(conn->data,
- "Unrecognized content encoding type. "
- "libcurl understands `identity', `deflate' and `gzip' "
- "content encodings.");
- return CHUNKE_BAD_ENCODING;
+ if(conn->data->set.http_ce_skip || !k->writer_stack) {
+ if(!k->ignorebody)
+ result = Curl_client_write(conn, CLIENTWRITE_BODY, datap, piece);
}
-#endif
+ else
+ result = Curl_unencode_write(conn, k->writer_stack, datap, piece);
if(result)
return CHUNKE_WRITE_ERROR;
*wrote += piece;
-
ch->datasize -= piece; /* decrease amount left to expect */
datap += piece; /* move read pointer forward */
length -= piece; /* decrease space left in this round */