GNURLOPT_HEADEROPT(3)

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

πŸ’– NAME πŸ’–

okay bestie, welcome to GNURLOPT_HEADEROPT(3) β€” this one is literally about setting how to send HTTP headers. no cap, that's the whole vibe.

✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HEADEROPT, long
bitmask);

πŸ¦‹ DESCRIPTION πŸ¦‹

You pass a long that is a bitmask of options for how to deal with headers. The two mutually exclusive options are:

πŸŽ€ DEFAULT πŸŽ€

CURLHEADER_SEPARATE (changed in 7.42.1, used CURLHEADER_UNIFIED before then)

🌸 PROTOCOLS 🌸

HTTP

🫢 EXAMPLE 🫢

CURL *curl = curl_easy_init();
if(curl) {
  CURLcode ret;
  struct curl_slist *list;
  list = curl_slist_append(NULL, "Shoesize: 10");
  list = curl_slist_append(list, "Accept:");
  curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:8080");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list);

  /* HTTPS over a proxy makes a separate CONNECT to the proxy, so tell
     libcurl to not send the custom headers to the proxy. Keep them
     separate! */
  curl_easy_setopt(curl, CURLOPT_HEADEROPT, CURLHEADER_SEPARATE);
  ret = curl_easy_perform(curl);
  curl_slist_free_all(list);
  curl_easy_cleanup(curl);
}

πŸ’… AVAILABILITY πŸ’…

Added in 7.37.0

πŸ‘‘ RETURN VALUE πŸ‘‘

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.

🌈 SEE ALSO 🌈


and that's the whole little header saga, bestie πŸ’– sign-off tea: this page is from libcurl 7.37.0, dated 19 Jun 2014 β€” iconic, honestly. πŸŽ€

πŸ“¦ where this page comes from