GNURLOPT_AUTOREFERER(3)

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

GNURLOPT_AUTOREFERER(3) πŸ’…

okay so bestie, this page lives in the curl_easy_setopt options manual, and it's literally here to explain the auto-referer glow-up. No cap. ✨

✨ NAME ✨

  • CURLOPT_AUTOREFERER β€” automatically update the referer header

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_AUTOREFERER, long
       autorefer);

🌸 DESCRIPTION 🌸

Pass a parameter set to 1 to enable this. When it's enabled, libcurl will automatically set the Referer: header field in HTTP requests where it follows a Location: redirect. It's giving self-updating header energy. πŸ’«

πŸŽ€ DEFAULT πŸŽ€

0, disabled β€” so it's off by default, bestie. πŸ™ˆ

πŸ”₯ PROTOCOLS πŸ”₯

HTTP. Periodt. πŸ’…

🌈 EXAMPLE 🌈

CURL *curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");

  /* follow redirects */
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

  /* set Referer: automatically when following redirects */
  curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1L);

  ret = curl_easy_perform(curl);

  curl_easy_cleanup(curl);
}

⭐ AVAILABILITY ⭐

Along with HTTP. 🫢

πŸ‘‘ RETURN VALUE πŸ‘‘

Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. 🎯

🫢 SEE ALSO 🫢

Also go peek at CURLOPT_REFERER(3), CURLOPT_FOLLOWLOCATION(3), β€” bestie homework. πŸ“š


mwah πŸ’‹ β€” this page is from libcurl 7.37.0, dated 17 Jun 2014. slay. πŸŽ€

πŸ“¦ where this page comes from