GNURLOPT_SOCKS5_AUTH(3)

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

bestie, welcome to the GNURLOPT_SOCKS5_AUTH(3) page, straight out of the curl_easy_setopt options manual β€” and yes, we're talking about SOCKS5 proxy auth, so let's get into it πŸ’…

✨ NAME ✨

CURLOPT_SOCKS5_AUTH β€” sets the allowed methods for SOCKS5 proxy authentication. That's the whole assignment, and it ate πŸ’–

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <gnurl/curl.h>

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

🌸 DESCRIPTION 🌸

Okay so you pass a long as the parameter, and it gets set to a bitmask. That bitmask tells libcurl which authentication method(s) are allowed for SOCKS5 proxy authentication. No cap, that's literally the job 🫢

The only supported flags are:

  • CURLAUTH_BASIC β€” allows username/password authentication
  • CURLAUTH_GSSAPI β€” allows GSS-API authentication
  • CURLAUTH_NONE β€” allows no authentication

Set the actual user name and password with the CURLOPT_PROXYUSERPWD(3) option. That's where the credentials go, bestie πŸ”‘

πŸŽ€ DEFAULT πŸŽ€

CURLAUTH_BASIC|CURLAUTH_GSSAPI

That's the default vibe, periodt ✨

🌈 PROTOCOLS 🌈

All β€” every protocol, no gatekeeping πŸ’«

πŸ”₯ EXAMPLE πŸ”₯

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

  /* request to use a SOCKS5 proxy */
  curl_easy_setopt(curl, CURLOPT_PROXY, "socks5://user:pass@myproxy.com");

  /* enable username/password authentication only */
  curl_easy_setopt(curl, CURLOPT_SOCKS5_AUTH, CURLAUTH_BASIC);

  /* Perform the request */
  curl_easy_perform(curl);
}

⭐ AVAILABILITY ⭐

Added in 7.55.0, so she's been around πŸ‘‘

πŸ’œ RETURN VALUE πŸ’œ

Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or CURLE_NOT_BUILT_IN if the bitmask contains unsupported flags. So like… check your bitmask, bestie, because unsupported flags are giving error energy 😭

πŸ“ SEE ALSO πŸ“


xoxo, libcurl 7.55.0, dated 27 April 2017 β€” page GNURLOPT_SOCKS5_AUTH(3) out πŸ’–πŸ’…βœ¨

πŸ“¦ where this page comes from