GNURLOPT_H...T_DECODING(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸŽ€ GNURLOPT_H...T_DECODING(3) πŸŽ€

okay so bestie, welcome to the curl_easy_setopt options corner of the gnurl manual β€” this one's about content decoding and it's honestly shorter than my attention span, so let's go ✨

πŸ’… NAME πŸ’…

CURLOPT_HTTP_CONTENT_DECODING β€” the little switch that turns HTTP content decoding on or off. yes queen, that's literally it 🫢

✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTP_CONTENT_DECODING,
                          long enabled);

🌸 DESCRIPTION 🌸

so you pass a long in there and it tells libcurl how to act on content decoding. the vibes are:

  • set it to zero ➑️ content decoding gets disabled, bye πŸ‘‹
  • set it to 1 ➑️ content decoding is enabled, slay πŸ’…
⚠️ and this is the important part, bestie: libcurl has no default content decoding on its own β€” it literally requires you to use CURLOPT_ACCEPT_ENCODING(3) for that. so don't come for libcurl asking why nothing's being decoded when you never told it anything. iykyk 😭

πŸ¦‹ DEFAULT πŸ¦‹

1

(not her being on by default and still needing CURLOPT_ACCEPT_ENCODING(3) β€” the audacity, honestly πŸ”₯)

🌈 PROTOCOLS 🌈

HTTP

that's the whole list. one protocol. main character energy πŸ‘‘

πŸ“ EXAMPLE πŸ“

CURL *curl = curl_easy_init();
if(curl) {
  CURLcode ret;
  curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  curl_easy_setopt(curl, CURLOPT_HTTP_CONTENT_DECODING, 0L);
  ret = curl_easy_perform(curl);
}

see how she passes 0L? that's decoding off, bestie. ate and left no crumbs πŸ’€

⭐ AVAILABILITY ⭐

added in 7.16.2 β€” a whole elder, lowkey iconic for it 🧚

πŸ’– RETURN VALUE πŸ’–

  • returns CURLE_OK if the option is supported πŸŽ€
  • returns CURLE_UNKNOWN_OPTION if it's not πŸ™ˆ

no in-between, no drama.

πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, bestie!! mwah πŸ’œ this lil slice of the gnurl world is brought to you by libcurl 7.37.0, dated 19 Jun 2014 β€” yes she's vintage, and yes she still serves 🫢✨

πŸ“¦ where this page comes from