that will work (besides "identity," which does nothing) are "deflate" and
"gzip" If a response is encoded using the "compress" or methods, libcurl will
return an error indicating that the response could not be decoded. If
-<string> is NULL or empty no Accept-Encoding header is generated.
+<string> is NULL no Accept-Encoding header is generated. If <string> is a
+zero-length string, then an Accept-Encoding header containing all supported
+encodings will be generated.
The CURLOPT_ENCODING must be set to any non-NULL value for content to be
automatically decoded. If it is not set and the server still sends encoded
*
* $Id$
***************************************************************************/
+#include "setup.h"
+
+/*
+ * Comma-separated list all supported Content-Encodings ('identity' is implied)
+ */
+#ifdef HAVE_LIBZ
+#define ALL_CONTENT_ENCODINGS "deflate, gzip"
+#else
+#define ALL_CONTENT_ENCODINGS "identity"
+#endif
CURLcode Curl_unencode_deflate_write(struct SessionHandle *data,
struct Curl_transfer_keeper *k,
if(k->badheader < HEADER_ALLBAD) {
/* This switch handles various content encodings. If there's an
error here, be sure to check over the almost identical code
- in http_chunks.c. 08/29/02 jhrg */
+ in http_chunks.c. 08/29/02 jhrg
+ Make sure that ALL_CONTENT_ENCODINGS contains all the
+ encodings handled here. */
#ifdef HAVE_LIBZ
switch (k->content_encoding) {
case IDENTITY:
#include "escape.h"
#include "strtok.h"
#include "share.h"
+#include "content_encoding.h"
/* And now for the protocols */
#include "ftp.h"
case CURLOPT_ENCODING:
/*
* String to use at the value of Accept-Encoding header. 08/28/02 jhrg
+ *
+ * If the encoding is set to "" we use an Accept-Encoding header that
+ * encompasses all the encodings we support.
+ * If the encoding is set to NULL we don't send an Accept-Encoding header
+ * and ignore an received Content-Encoding header.
+ *
*/
data->set.encoding = va_arg(param, char *);
+ if(data->set.encoding && !*data->set.encoding)
+ data->set.encoding = (char*)ALL_CONTENT_ENCODINGS;
break;
case CURLOPT_USERPWD: