1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_TRANSFER_ENCODING 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_ACCEPT_ENCODING (3) 9 - CURLOPT_HTTP_TRANSFER_DECODING (3) 10Protocol: 11 - HTTP 12--- 13 14# NAME 15 16CURLOPT_TRANSFER_ENCODING - ask for HTTP Transfer Encoding 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TRANSFER_ENCODING, 24 long enable); 25~~~ 26 27# DESCRIPTION 28 29Pass a long set to 1L to *enable* or 0 to disable. 30 31Adds a request for compressed Transfer Encoding in the outgoing HTTP 32request. If the server supports this and so desires, it can respond with the 33HTTP response sent using a compressed Transfer-Encoding that is automatically 34uncompressed by libcurl on reception. 35 36Transfer-Encoding differs slightly from the Content-Encoding you ask for with 37CURLOPT_ACCEPT_ENCODING(3) in that a Transfer-Encoding is strictly meant 38to be for the transfer and thus MUST be decoded before the data arrives in the 39client. Traditionally, Transfer-Encoding has been much less used and supported 40by both HTTP clients and HTTP servers. 41 42# DEFAULT 43 440 45 46# EXAMPLE 47 48~~~c 49int main(void) 50{ 51 CURL *curl = curl_easy_init(); 52 if(curl) { 53 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 54 curl_easy_setopt(curl, CURLOPT_TRANSFER_ENCODING, 1L); 55 curl_easy_perform(curl); 56 } 57} 58~~~ 59 60# AVAILABILITY 61 62Added in 7.21.6 63 64# RETURN VALUE 65 66Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 67