CURLOPT_PROXYUSERNAME(3)

okay so bestie, welcome to the libcurl manual page for CURLOPT_PROXYUSERNAME(3) β€” yes, the whole page is about the username to use for proxy authentication, and it's lowkey iconic. πŸ’…

✨ NAME ✨

CURLOPT_PROXYUSERNAME β€” username to use for proxy authentication. that's the vibe. πŸŽ€

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYUSERNAME,
                          char *username);

πŸ’– DESCRIPTION πŸ’–

Pass a char * pointer as the parameter, and it should be pointing to the null-terminated username to use for the transfer. literally just give it the username string, bestie. ✨

CURLOPT_PROXYUSERNAME(3) sets the username to be used in protocol authentication with the proxy. that's the whole assignment. 🫢

To specify the proxy password, use CURLOPT_PROXYPASSWORD(3). password goes there, username goes here β€” keep the pair cute and separate. πŸ’–

The application does not have to keep the string around after setting this option. so you don't gotta babysit that string after you set it. 😌

πŸŽ€ DEFAULT πŸŽ€

blank. that's the default. πŸŽ€

🌈 PROTOCOLS 🌈

This functionality affects all supported protocols. all of them. no cap. 🌈

πŸ“ EXAMPLE πŸ“

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
    curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:8080");
    curl_easy_setopt(curl, CURLOPT_PROXYUSERNAME, "mrsmith");
    curl_easy_setopt(curl, CURLOPT_PROXYPASSWORD, "qwerty");
    result = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
  }
}

⭐ AVAILABILITY ⭐

Added in curl 7.19.1. that's when this icon was born, bestie. ⭐

πŸ”₯ RETURN VALUE πŸ”₯

curl_easy_setopt(3) returns a CURLcode indicating success or error. πŸ“¬

CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3). if it's non-zero, it's giving error β€” go check that page. πŸ”₯

πŸ‘‘ SEE ALSO πŸ‘‘


mwah πŸ’‹ β€” libcurl manual page, dated 2026-10-12, all about CURLOPT_PROXYUSERNAME(3).

πŸ“¦ where this page comes from