CURLOPT_SU...CT_HEADERS(3)
π CURLOPT_SUPPRESS_CONNECT_HEADERS π
okay bestie so this is a page straight out of the Library Functions Manual for libcurl, and it's about CURLOPT_SUPPRESS_CONNECT_HEADERS β literally the option that tells curl to stop showing you the proxy's extra headers. it's giving "quiet luxury" for your callback functions. iykyk π
β¨ NAME β¨
CURLOPT_SUPPRESS_CONNECT_HEADERS β suppress proxy CONNECT response headers, periodt. π
πΈ SYNOPSIS πΈ
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SUPPRESS_CONNECT_HEADERS, long onoff);
π¦ DESCRIPTION π¦
so here's the tea π« β when CURLOPT_HTTPPROXYTUNNEL(3) is in play and a CONNECT request happens, this option suppresses the proxy CONNECT response headers so they never reach your user callback functions CURLOPT_HEADERFUNCTION(3) and CURLOPT_WRITEFUNCTION(3). no cap.
why would you want that? because proxy CONNECT response headers can lowkey complicate your header processing β it's basically a whole separate set of headers just chilling there. you can enable this option to suppress them. slay. β¨
okay so for example, let's say you're retrieving an HTTPS URL via CONNECT. on success there would normally be two sets of headers, and every single header line gets sent to the header function and/or the write function. the data your callbacks receive would look like this:
HTTP/1.1 200 Connection established
{headers}
...
HTTP/1.1 200 OK
Content-Type: application/json
{headers}
...
{body}
...
but β plot twist π¬ β by enabling this option the CONNECT response headers get suppressed, so the data given to the callbacks would look like this instead:
HTTP/1.1 200 OK
Content-Type: application/json
{headers}
...
{body}
...
so much cleaner. the way that second block ate and left no crumbs. π
π DEFAULT π
0
(the extra headers are not suppressed unless you say so, bestie π«Ά)
π PROTOCOLS π
this functionality affects all supported protocols. all of them. every single one. iconic behaviour honestly. β
π EXAMPLE π
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy.example:3128");
curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
curl_easy_setopt(curl, CURLOPT_SUPPRESS_CONNECT_HEADERS, 1L);
curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
}
look at her go ππ
π§ AVAILABILITY π§
added in curl 7.54.0 β so if you're on something ancient, that's a vibe check you're gonna fail π
π₯ RETURN VALUE π₯
CURLE_OK or an error such as CURLE_UNKNOWN_OPTION.
so basically: success, or a lil error telling you things went sideways π
π SEE ALSO π
go read those next, bestie, they're all part of the same little friend group π«Ά
and that's the whole page, mwah π β brought to you by libcurl, dated 2026-10-12, straight from the Library Functions Manual. go forth and suppress those headers, main character. β¨ππ¦
π¦ 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