GNURLOPT_HAPROXYPROTOCOL(3)

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

πŸŽ€ GNURLOPT_HAPROXYPROTOCOL(3) πŸŽ€

okay bestie, welcome to the curl_easy_setopt options corner β€” this page is literally all about CURLOPT_HAPROXYPROTOCOL, and it's giving very specific test-request energy.


✨ NAME ✨

CURLOPT_HAPROXYPROTOCOL β€” send HAProxy PROXY protocol v1 header. no cap, that's the whole name vibe. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

okay so you pull in the header, then call curl_easy_setopt like this:

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HAPROXYPROTOCOL,
                          long haproxy_protocol);

πŸ’… DESCRIPTION πŸ’…

Here's the tea: you pass a long parameter set to 1, and the library will send an HAProxy PROXY protocol v1 header at the beginning of the connection. The default action? Not sending this header at all β€” she's lowkey minding her business. πŸ’–

This option is primarily useful when you're sending test requests to a service that expects this header. iykyk. 🧚

Most applications do not need this option. fr fr, don't reach for it unless you know you need it.


🌸 DEFAULT 🌸

  • 0 β€” do not send any HAProxy PROXY protocol header. simple as that. πŸ’–

🌈 PROTOCOLS 🌈

  • HTTP β€” that's the protocol club for this option. ✨

πŸ”₯ EXAMPLE πŸ”₯

CURL *curl = curl_easy_init();
if(curl) {
  CURLcode ret;
  curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  curl_easy_setopt(curl, CURLOPT_HAPROXYPROTOCOL, 1L);
  ret = curl_easy_perform(curl);
}

⭐ AVAILABILITY ⭐

Along with HTTP. Added in 7.60.0. periodt. πŸ‘‘


🫢 RETURN VALUE 🫢

Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not. that's the whole mood. πŸ’€


and that's the page, bestie β€” signing off from libcurl 7.60.0, dated 5 Feb 2018, with main-character energy for GNURLOPT_HAPROXYPROTOCOL(3) πŸ’–βœ¨

πŸ“¦ where this page comes from