CURLOPT_TRANSFER_ENCODING.3 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. .\" generated by cd2nroff 0.1 from CURLOPT_TRANSFER_ENCODING.md
  2. .TH CURLOPT_TRANSFER_ENCODING 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_TRANSFER_ENCODING \- ask for HTTP Transfer Encoding
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TRANSFER_ENCODING,
  9. long enable);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a long set to 1L to \fIenable\fP or 0 to disable.
  13. Adds a request for compressed Transfer Encoding in the outgoing HTTP
  14. request. If the server supports this and so desires, it can respond with the
  15. HTTP response sent using a compressed Transfer\-Encoding that is automatically
  16. uncompressed by libcurl on reception.
  17. Transfer\-Encoding differs slightly from the Content\-Encoding you ask for with
  18. \fICURLOPT_ACCEPT_ENCODING(3)\fP in that a Transfer\-Encoding is strictly meant
  19. to be for the transfer and thus MUST be decoded before the data arrives in the
  20. client. Traditionally, Transfer\-Encoding has been much less used and supported
  21. by both HTTP clients and HTTP servers.
  22. .SH DEFAULT
  23. 0
  24. .SH PROTOCOLS
  25. This functionality affects http only
  26. .SH EXAMPLE
  27. .nf
  28. int main(void)
  29. {
  30. CURL *curl = curl_easy_init();
  31. if(curl) {
  32. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  33. curl_easy_setopt(curl, CURLOPT_TRANSFER_ENCODING, 1L);
  34. curl_easy_perform(curl);
  35. }
  36. }
  37. .fi
  38. .SH AVAILABILITY
  39. Added in curl 7.21.6
  40. .SH RETURN VALUE
  41. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  42. .SH SEE ALSO
  43. .BR CURLOPT_ACCEPT_ENCODING (3),
  44. .BR CURLOPT_HTTP_TRANSFER_DECODING (3)