GNURLOPT_U...ICTED_AUTH(3)

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

πŸ’– NAME πŸ’–

First things first, bestie: you're on the GNURLOPT_U...ICTED_AUTH(3) page, from the curl_easy_setopt options manual β€” yes, the title is having a dramatic ellipsis moment, and we're obsessed. πŸ’…

The option is CURLOPT_UNRESTRICTED_AUTH β€” it means send credentials to other hosts too. That's the whole vibe: it's the β€œokay, you can take my user+password with you when you bounce to another host” option. πŸ‘‘

✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UNRESTRICTED_AUTH,
                          long goahead);

🌸 DESCRIPTION 🌸

Okay so here's the tea: set the long gohead parameter to 1L and libcurl will keep sending authentication (user+password) credentials when it follows locations β€” even when hostname changed. Yes, that's the whole point. It's giving β€œfollow me, and bring the login too.” 🫢

(And yes, the page has gohead there and goahead in the synopsis β€” I'm not fixing the typo, I'm preserving the lore. 😭)

This option is meaningful only when you're setting CURLOPT_FOLLOWLOCATION(3) β€” like, that's the context where it actually does its thing. iykyk.

By default, libcurl will only send the given credentials to the initial host name as given in the original URL. Why? To avoid leaking username + password to other sites. No cap, that default is the cautious icon we need. πŸ”’

πŸŽ€ DEFAULT πŸŽ€

0

πŸ¦‹ PROTOCOLS πŸ¦‹

HTTP

⭐ EXAMPLE ⭐

CURL *curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_UNRESTRICTED_AUTH, 1L);
  curl_easy_perform(curl);
}

🌈 AVAILABILITY 🌈

Along with HTTP. ✨

πŸ’œ RETURN VALUE πŸ’œ

Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not. Simple as that, bestie. 🫢

πŸ”₯ SEE ALSO πŸ”₯


Cute sign-off: this page is from libcurl 7.37.0, dated 17 Jun 2014, and it's the GNURLOPT_U...ICTED_AUTH(3) page. Byeee, bestie πŸ’…βœ¨

πŸ“¦ where this page comes from