CURLOPT_PROXYPORT(3)

πŸ’… CURLOPT_PROXYPORT(3) πŸ’…

okay bestie, quick vibe check: this is a page straight out of the Library Functions Manual, and it's all about CURLOPT_PROXYPORT β€” literally just the port number the proxy listens on. that's the whole assignment. πŸŽ€


✨ NAME ✨

CURLOPT_PROXYPORT β€” the port number your proxy is chilling on 🫢


🌸 SYNOPSIS 🌸

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYPORT, long port);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so first thing, no cap: we discourage use of this option. like, we're telling you this up front so you can't say we didn't warn you πŸ™ˆ

if you do use it, you pass a long with this option to set the proxy port to connect to β€” unless it's already specified in the proxy string CURLOPT_PROXY(3), or unless it uses 443 for https proxies and 1080 for all others as the default. iykyk πŸ’…

disabling this option β€” meaning setting it to zero β€” makes it not specified, which makes libcurl use the default proxy port number, or the port number specified in the proxy URL string. so zero is basically the "idk, you pick" setting ✨

and here's the lil catch: while this accepts a long, the port number is 16 bit, so it cannot be larger than 65535. periodt. don't try it. πŸ’€


πŸ“ DEFAULT πŸ“

0


🌈 PROTOCOLS 🌈

this functionality affects all supported protocols πŸ‘‘


πŸ’– 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, "localhost");
    curl_easy_setopt(curl, CURLOPT_PROXYPORT, 8080L);
    result = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
  }
}

look at her go 😭 she's setting the URL, setting the proxy to localhost, and telling it port 8080L β€” iconic behavior honestly πŸŽ€


⭐ AVAILABILITY ⭐

added in curl 7.1 β€” she's been around a minute, a real veteran πŸ’œ


🧚 RETURN VALUE 🧚

curl_easy_setopt(3) returns a CURLcode indicating success or error β€” you know the drill.

CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3). zero is the slay number, anything else is a cry for help 😭


πŸ‘‘ SEE ALSO πŸ‘‘

go read those too, they're all in the same friend group fr fr 🫢


and that's the whole page bestie!! this was libcurl, dated 2026-10-12 β€” mwah, see you in the next manpage πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from