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