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