summaryrefslogtreecommitdiff
path: root/lib/http_chunks.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-09-02 22:31:18 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-09-02 22:31:18 +0000
commit64bbe9dfafc6693a96b742f3133c636385835a19 (patch)
tree012bda8b5d41f89cd774b0aa7cc8cacc23aac175 /lib/http_chunks.c
parent2e8a9416af0b59e98132e64c29f3919d9a7b9570 (diff)
downloadcurl-64bbe9dfafc6693a96b742f3133c636385835a19.tar.gz
James Gallagher's Content-Encoding work
Diffstat (limited to 'lib/http_chunks.c')
-rw-r--r--lib/http_chunks.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/http_chunks.c b/lib/http_chunks.c
index 939e86a91..784d231fe 100644
--- a/lib/http_chunks.c
+++ b/lib/http_chunks.c
@@ -33,6 +33,8 @@
#include "urldata.h" /* it includes http_chunks.h */
#include "sendf.h" /* for the client write stuff */
+#include "content_encoding.h" /* 08/29/02 jhrg */
+
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
@@ -172,7 +174,32 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
piece = (ch->datasize >= length)?length:ch->datasize;
/* Write the data portion available */
- result = Curl_client_write(conn->data, CLIENTWRITE_BODY, datap, piece);
+ /* Added content-encoding here; untested but almost identical to the
+ tested code in transfer.c. 08/29/02 jhrg */
+#ifdef HAVE_LIBZ
+ switch (conn->keep.content_encoding) {
+ case IDENTITY:
+#endif
+ result = Curl_client_write(conn->data, CLIENTWRITE_BODY, datap,
+ piece);
+#ifdef HAVE_LIBZ
+ break;
+
+ case DEFLATE:
+ result = Curl_unencode_deflate_write(conn->data, &conn->keep, piece);
+ break;
+
+ case GZIP:
+ case COMPRESS:
+ default:
+ failf (conn->data,
+ "Unrecognized content encoding type. "
+ "libcurl understands `identity' and `deflate' "
+ "content encodings.");
+ return CHUNKE_BAD_ENCODING;
+ }
+#endif
+
if(result)
return CHUNKE_WRITE_ERROR;
*wrote += piece;