GNURLOPT_NETRC_FILE(3)

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

πŸ’– GNURLOPT_NETRC_FILE(3) Β· curl_easy_setopt options πŸ’–

okay bestie, welcome to the GNURLOPT_NETRC_FILE page β€” it's part of the curl_easy_setopt options manual, and it's literally all about telling libcurl which .netrc file to read from. πŸŽ€


✨ NAME ✨

  • CURLOPT_NETRC_FILE β€” file name to read .netrc info from. yep, that's the whole vibe: you're picking the file name. πŸ’…

🌸 SYNOPSIS 🌸

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NETRC_FILE, char *file);

πŸ¦‹ DESCRIPTION πŸ¦‹

Pass a char * as the parameter, pointing at a null-terminated string containing the full path name to the file you want libcurl to use as its .netrc file. Like, the whole path, bestie. ✨

If this option is omitted, and CURLOPT_NETRC(3) is set, libcurl will attempt to find a .netrc file in the current user's home directory. cute little fallback behavior, no cap. 🫢

The application does not have to keep the string around after setting this option. so you can let that string go, it's not clingy. πŸ’–

πŸŽ€ DEFAULT πŸŽ€

NULL

🌈 PROTOCOLS 🌈

All β€” every protocol, periodt. πŸ‘‘

πŸ”₯ EXAMPLE πŸ”₯

CURL *curl = curl_easy_init();
if(curl) {
  CURLcode ret;
  curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/");
  curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
  curl_easy_setopt(curl, CURLOPT_NETRC_FILE, "/tmp/magic-netrc");
  ret = curl_easy_perform(curl);
}

⭐ AVAILABILITY ⭐

Added in 7.10.9 β€” she's been around since back then. πŸ’œ

πŸ’€ RETURN VALUE πŸ’€

Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space. no cap, those are the three outcomes. 😭

πŸ‘€ SEE ALSO πŸ‘€


okay that's the whole page, bestie! 🧚 this was libcurl 7.37.0, dated 19 Jun 2014 β€” shoutout to the GNURLOPT_NETRC_FILE(3) manual page, mwah πŸ’‹

πŸ“¦ where this page comes from