CURLOPT_PR...H_USERNAME(3)

πŸ’… CURLOPT_PROXY_TLSAUTH_USERNAME(3) β€” the glam little page from libcurl's Library Functions Manual

okay so bestie, picture this: you're doing TLS auth to a proxy (yes, a proxy, not the server, keep up ✨) and the proxy wants a username. That's literally what this option is for. It's the proxy-side sibling of the regular TLS auth username, and she's giving "supporting character but make it essential" energy. πŸŽ€

Heads up, the header of this page gets truncated to CURLOPT_PR...H_USERNAME(3) because the name is lowkey too long for the man page column, but you and I both know what she's called. πŸ‘‘


✨ NAME ✨

CURLOPT_PROXY_TLSAUTH_USERNAME β€” the username to use for proxy TLS authentication 🫢


🌸 SYNOPSIS 🌸

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_TLSAUTH_USERNAME,
                          char *user);

πŸ¦‹ DESCRIPTION πŸ¦‹

So you pass a char pointer as the parameter, and it should point to a null-terminated username string. That string is what gets used for the HTTPS proxy TLS authentication method you picked over in CURLOPT_PROXY_TLSAUTH_TYPE(3). 🌈

Big requirement though: this option needs CURLOPT_PROXY_TLSAUTH_PASSWORD(3) to also be set. It's a two-piece outfit, you can't wear just the top. πŸ’€

Good news for your memory management anxiety: the application does not have to keep the string around after setting this option. Set it and forget it, she's copied. ✨

And if you're the type to set this multiple times (no judgement, we've all been there πŸ™ˆ): the last set string overrides the previous ones. Setting it to NULL disables its use again, like a clean slate moment. πŸ’œ


πŸŽ€ DEFAULT πŸŽ€

NULL

(no username, no proxy TLS auth username-ing, that's the vibe)


πŸ”₯ PROTOCOLS πŸ”₯

This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. Basically if it's got an S on the end and TLS in its soul, she's in. ⭐

⚠️ but here's the catch, bestie: this option works only with the following TLS backends: GnuTLS and OpenSSL. If you're on a different backend, this is not your moment. 😭

🌟 EXAMPLE 🌟

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
    curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy.example");
    curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_TYPE, "SRP");
    curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_USERNAME, "user");
    curl_easy_setopt(curl, CURLOPT_PROXY_TLSAUTH_PASSWORD, "secret");
    result = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
  }
}

look at her. URL set, proxy set, SRP chosen, username "user", password "secret", perform, cleanup. The whole little routine, no cap. 🧚


πŸ’– AVAILABILITY πŸ’–

Added in curl 7.52.0 β€” so she's been iconic since 2016, iykyk. πŸ‘‘


πŸ“ 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 β€” go check libcurl-errors(3) for the tea. πŸ”


🌈 SEE ALSO 🌈


and that's the page, bestie 🫢 mwah πŸ’‹

🌸 sign-off szn: this gem is from libcurl, dated 2026-10-12, and its footer name is the ever-truncated CURLOPT_PR...H_USERNAME(3). periodt. ✨
πŸ“¦ where this page comes from