GNURLOPT_PROXYPORT(3)

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

πŸ’… GNURLOPT_PROXYPORT(3) β€” like, the actual curl_easy_setopt options page, bestie

okay so real talk, this is one of the pages from the curl_easy_setopt options manual set, and it's about telling curl which port your proxy is vibing on. it's short, it's sweet, it's giving "one job and it does it" energy. let's go 🫢


✨ NAME ✨

CURLOPT_PROXYPORT β€” literally the port number your proxy listens on πŸŽ€

🌸 SYNOPSIS 🌸

#include <gnurl/curl.h>

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

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so you pass a long with this option and that sets the proxy port to connect to β€” unless the port is already specified in the proxy string you gave to CURLOPT_PROXY(3), in which case that one wins. and if nobody specifies anything? it defaults to 443 for https proxies and 1080 for all others. slay, sensible defaults πŸ’…

and listen, even though this thing accepts a long (big boi number), the port number is 16 bit, so it can't be larger than 65535. no cap. that's the ceiling, that's the whole ceiling. 😭

ok so genuinely important: 16 bit means 65535 is the max. don't come at it with a bigger number and expect it to work, bestie.

⭐ OPTIONS ⭐

  • CURLOPT_PROXYPORT β€” the long holding the proxy port you wanna connect to. overridden by whatever's in the CURLOPT_PROXY(3) string if that has a port in it. capped at 65535 because 16 bit. πŸ‘‘

πŸ“ DEFAULT πŸ“

0, which means it's not specified β€” so it just uses the default port. lowkey the most chill default ever. ✨

🌈 PROTOCOLS 🌈

All. every single one. equal opportunity proxy port. 🫢

🧚 EXAMPLE 🧚

CURL *curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
  curl_easy_setopt(curl, CURLOPT_PROXY, "localhost");
  curl_easy_setopt(curl, CURLOPT_PROXYPORT, 8080L);
  ret = curl_easy_perform(curl);
  curl_easy_cleanup(curl);
}

see how it's 8080L? that's the long doing its thing. don't forget the L, it's part of the aesthetic. and yes the example really does say ret without declaring it, that's just how the page is, i don't make the rules πŸ’€

πŸ’œ AVAILABILITY πŸ’œ

Always. it's been here since forever, it's iconic, it's not going anywhere. πŸ‘‘

πŸŽ€ RETURN VALUE πŸŽ€

Returns CURLE_OK. that's it. that's the whole return value. no drama, no surprises, we love a low-maintenance icon. πŸ’–

πŸ’… SEE ALSO πŸ’…


and that's the whole page, bestie!! πŸ¦‹ so like, this was libcurl 7.37.0, dated 17 Jun 2014 β€” yes she's vintage, she's a classic, and she still eats. mwah πŸ’‹πŸŒΊ

πŸ“¦ where this page comes from