1CURLOPT_TRANSFER_ENCODING(3)curl_easy_setopt optionsCURLOPT_TRANSFER_ENCODING(3)
2
3
4
6 CURLOPT_TRANSFER_ENCODING - ask for HTTP Transfer Encoding
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TRANSFER_ENCODING,
12 long enable);
13
15 Pass a long set to 1L to enable or 0 to disable.
16
17 Adds a request for compressed Transfer Encoding in the outgoing HTTP
18 request. If the server supports this and so desires, it can respond
19 with the HTTP response sent using a compressed Transfer-Encoding that
20 will be automatically uncompressed by libcurl on reception.
21
22 Transfer-Encoding differs slightly from the Content-Encoding you ask
23 for with CURLOPT_ACCEPT_ENCODING(3) in that a Transfer-Encoding is
24 strictly meant to be for the transfer and thus MUST be decoded before
25 the data arrives in the client. Traditionally, Transfer-Encoding has
26 been much less used and supported by both HTTP clients and HTTP
27 servers.
28
30 0
31
33 HTTP
34
36 CURL *curl = curl_easy_init();
37 if(curl) {
38 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
39 curl_easy_setopt(curl, CURLOPT_TRANSFER_ENCODING, 1L);
40 curl_easy_perform(curl);
41 }
42
44 Added in 7.21.6
45
47 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
48 if not.
49
51 CURLOPT_ACCEPT_ENCODING(3), CURLOPT_HTTP_TRANSFER_DECODING(3),
52
53
54
55libcurl 7.85.0 May 17, 2022 CURLOPT_TRANSFER_ENCODING(3)