1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_HTTP_TRANSFER_DECODING
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_ACCEPT_ENCODING (3)
9  - CURLOPT_HTTP_CONTENT_DECODING (3)
10---
11
12# NAME
13
14CURLOPT_HTTP_TRANSFER_DECODING - HTTP transfer decoding control
15
16# SYNOPSIS
17
18~~~c
19#include <curl/curl.h>
20
21CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTP_TRANSFER_DECODING,
22                         long enabled);
23~~~
24
25# DESCRIPTION
26
27Pass a long to tell libcurl how to act on transfer decoding. If set to zero,
28transfer decoding is disabled, if set to 1 it is enabled (default). libcurl
29does chunked transfer decoding by default unless this option is set to zero.
30
31# DEFAULT
32
331
34
35# PROTOCOLS
36
37HTTP
38
39# EXAMPLE
40
41~~~c
42int main(void)
43{
44  CURL *curl = curl_easy_init();
45  if(curl) {
46    CURLcode ret;
47    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
48    curl_easy_setopt(curl, CURLOPT_HTTP_TRANSFER_DECODING, 0L);
49    ret = curl_easy_perform(curl);
50  }
51}
52~~~
53
54# AVAILABILITY
55
56Added in 7.16.2 Does not work with the hyper backend (it always has transfer
57decoding enabled).
58
59# RETURN VALUE
60
61Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
62