CURLOPT_PROXYUSERPWD(3)
π CURLOPT_PROXYUSERPWD(3) β like, the proxy login page
okay bestie, this is <pink>CURLOPT_PROXYUSERPWD</pink> from the Library Functions Manual, and it's genuinely the glow-up your proxy connection has been waiting for β¨ It's all about the username + password combo you hand over when your HTTP proxy is like "who are you tho??" π«Ά
β¨ NAME β¨
CURLOPT_PROXYUSERPWD β the username and password you use for proxy authentication π
πΈ SYNOPSIS πΈ
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYUSERPWD, char *userpwd);
π¦ DESCRIPTION π¦
So you pass in a char pointer as the parameter, and that string should be shaped like [username]:[password] β that's the creds for connecting to the HTTP proxy π
Here's the part that lowkey trips people up: both the name and the password get URL decoded before they're used. So if you need an actual colon inside the username, you gotta encode it as %3A. And yes, this is different from how CURLOPT_USERPWD(3) works β beware, bestie, beware π
Wanna pick the auth method too? That's CURLOPT_PROXYAUTH(3), bestie, go off π
Good news though: the application does not have to keep the string around after setting this option. Set it and forget it, main character energy π§
Set it multiple times? No stress β the last string you set overrides all the previous ones. And if you set it to NULL, that disables it again. Clean slate, periodt β¨
π DEFAULT π
NULL
π PROTOCOLS π
This functionality affects all supported protocols β every single one, 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_PROXYUSERPWD, "clark%20kent:superman");
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
}
(not clark%20kent being Clark Kent, the man is literally flying under the radar, iconic π¦ΈββοΈπ)
β AVAILABILITY β
Added in curl 7.1 β a certified classic, she's been here a while π
π RETURN VALUE π
curl_easy_setopt(3) returns a CURLcode that tells you whether it slayed or flopped:
CURLE_OK(0) β everything was OK, we ate π- non-zero β an error happened π see
libcurl-errors(3)for the details
π«Ά SEE ALSO π«Ά
and that's the whole page, bestie β brought to you by the good people of libcurl, version dated 2026-10-12, and this little doc is CURLOPT_PROXYUSERPWD(3). go authenticate something gorgeous π
β¨
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms