content_encoding: add zstd decoding support

include zstd curl patch for Makefile.m32 from vszakats
and include Add CMake support for zstd from Peter Wu

Helped-by: Viktor Szakats
Helped-by: Peter Wu
Closes #5453
This commit is contained in:
Gilles Vollant 2020-05-25 17:49:46 +02:00 committed by Daniel Stenberg
parent c4026a9897
commit e13357b14b
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
21 changed files with 813 additions and 16 deletions

View file

@ -24,7 +24,7 @@
#
## Makefile for building curl examples with MingW (GCC-3.2 or later)
## and optionally OpenSSL (1.0.2a), libssh2 (1.5), zlib (1.2.8), librtmp (2.4),
## brotli (1.0.1)
## brotli (1.0.1), zstd (1.4.5)
##
## Usage: mingw32-make -f Makefile.m32 CFG=-feature1[-feature2][-feature3][...]
## Example: mingw32-make -f Makefile.m32 CFG=-zlib-ssl-sspi-winidn
@ -39,6 +39,10 @@
ifndef ZLIB_PATH
ZLIB_PATH = ../../../zlib-1.2.8
endif
# Edit the path below to point to the base of your Zstandard sources.
ifndef ZSTD_PATH
ZSTD_PATH = ../../../zstd-1.4.5
endif
# Edit the path below to point to the base of your Brotli sources.
ifndef BROTLI_PATH
BROTLI_PATH = ../../../brotli-1.0.1
@ -180,6 +184,9 @@ endif
ifeq ($(findstring -zlib,$(CFG)),-zlib)
ZLIB = 1
endif
ifeq ($(findstring -zstd,$(CFG)),-zstd)
ZSTD = 1
endif
ifeq ($(findstring -brotli,$(CFG)),-brotli)
BROTLI = 1
endif
@ -284,6 +291,11 @@ ifdef ZLIB
CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
curl_LDADD += -L"$(ZLIB_PATH)" -lz
endif
ifdef ZSTD
INCLUDES += -I"$(ZSTD_PATH)/include"
CFLAGS += -DHAVE_ZSTD
curl_LDADD += -L"$(ZSTD_PATH)/lib" -lzstd
endif
ifdef BROTLI
INCLUDES += -I"$(BROTLI_PATH)/include"
CFLAGS += -DHAVE_BROTLI

View file

@ -92,6 +92,11 @@ typedef struct {
be NULL */
const char *capath; /* the built-in default CURLOPT_CAPATH, might
be NULL */
/* when 'age' is CURLVERSION_EIGHTH or higher (>= 7.71.0), the members
below exist */
unsigned int zstd_ver_num; /* Numeric Zstd version
(MAJOR << 24) | (MINOR << 12) | PATCH */
const char *zstd_version; /* human readable string. */
} curl_version_info_data;
.fi
@ -121,6 +126,8 @@ more exact timeouts (even on Windows) and less blocking when using the multi
interface. (added in 7.10.7)
.IP CURL_VERSION_BROTLI
supports HTTP Brotli content encoding using libbrotlidec (Added in 7.57.0)
.IP CURL_VERSION_ZSTD
supports HTTP zstd content encoding using zstd library (Added in 7.72.0)
.IP CURL_VERSION_CONV
libcurl was built with support for character conversions, as provided by the
CURLOPT_CONV_* callbacks. (Added in 7.15.4)

View file

@ -45,8 +45,9 @@ Alternatively, you can specify exactly the encoding or list of encodings you
want in the response. Four encodings are supported: \fIidentity\fP, meaning
non-compressed, \fIdeflate\fP which requests the server to compress its
response using the zlib algorithm, \fIgzip\fP which requests the gzip
algorithm and (since curl 7.57.0) \fIbr\fP which is brotli. Provide them in
the string as a comma-separated list of accepted encodings, like:
algorithm, (since curl 7.57.0) \fIbr\fP which is brotli and (since curl
7.72.0) \fIzstd\fP which is zstd. Provide them in the string as a
comma-separated list of accepted encodings, like:
"br, gzip, deflate".
@ -94,8 +95,9 @@ if(curl) {
This option was called CURLOPT_ENCODING before 7.21.6
The specific libcurl you're using must have been built with zlib to be able to
decompress gzip and deflate responses and with the brotli library to
decompress brotli responses.
decompress gzip and deflate responses, with the brotli library to
decompress brotli responses and with the zstd library to decompress zstd
responses.
.SH RETURN VALUE
Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
CURLE_OUT_OF_MEMORY if there was insufficient heap space.

View file

@ -803,6 +803,7 @@ CURLU_NO_DEFAULT_PORT 7.62.0
CURLU_PATH_AS_IS 7.62.0
CURLU_URLDECODE 7.62.0
CURLU_URLENCODE 7.62.0
CURLVERSION_EIGHTH 7.72.0
CURLVERSION_FIFTH 7.57.0
CURLVERSION_FIRST 7.10
CURLVERSION_FOURTH 7.16.1
@ -968,6 +969,7 @@ CURL_VERSION_SSL 7.10
CURL_VERSION_SSPI 7.13.2
CURL_VERSION_TLSAUTH_SRP 7.21.4
CURL_VERSION_UNIX_SOCKETS 7.40.0
CURL_VERSION_ZSTD 7.72.0
CURL_WAIT_POLLIN 7.28.0
CURL_WAIT_POLLOUT 7.28.0
CURL_WAIT_POLLPRI 7.28.0