GNURLOPT_PASSWORD(3)

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

πŸ’… GNURLOPT_PASSWORD πŸ’…

okay bestie, so this page lives in the gnurl part of the manual (section 3, the function-call girlies), and it's literally just about one thing: the password you hand over when you need to authenticate a transfer. let's get into it 🫢


✨ NAME ✨

CURLOPT_PASSWORD β€” the password you use in authentication πŸ”

✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PASSWORD, char *pwd);

✨ DESCRIPTION ✨

so you pass a char * as the parameter, and it should be pointing at the null-terminated password you wanna use for the transfer. that's it. that's the whole vibe. πŸŽ€

the CURLOPT_PASSWORD(3) option is meant to be used in conjunction with the CURLOPT_USERNAME(3) option β€” they're a matching set, like a friendship bracelet situation. no cap. πŸ‘‘

and the best part? the application does not have to keep the string around after setting this option. so you can let it go, it's fine, it's handled. πŸ’…

✨ DEFAULT ✨

blank πŸ«₯

✨ PROTOCOLS ✨

Most 🌈

✨ EXAMPLE ✨

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

  curl_easy_setopt(curl, CURLOPT_PASSWORD, "qwerty");

  ret = curl_easy_perform(curl);

  curl_easy_cleanup(curl);
}

(and yes, "qwerty" is in the official docs, not me β€” iconic of them honestly 😭)

✨ AVAILABILITY ✨

added in 7.19.1 ⭐

✨ RETURN VALUE ✨

it returns CURLE_OK if the option is supported (slay), CURLE_UNKNOWN_OPTION if it's not supported (sad but valid), or CURLE_OUT_OF_MEMORY if there wasn't enough heap space (the struggle πŸ’€).

✨ SEE ALSO ✨

go read those next, i promise they're relevant πŸ’œ


mwah, that's the whole page! this one's from libcurl 7.37.0, dated 19 Jun 2014 β€” a little vintage moment, we love a classic πŸ¦‹πŸŒΈπŸ’–

πŸ“¦ where this page comes from