CURLINFO_HEADER_SIZE(3)

πŸ’– CURLINFO_HEADER_SIZE πŸ’–

okay bestie, so this is the libcurl library functions manual page for CURLINFO_HEADER_SIZE, and it's literally the glow-up you need for measuring how chunky your response headers are. it's giving "i just want to know the byte count" energy and honestly? iconic. ✨


✨ NAME ✨

CURLINFO_HEADER_SIZE β€” the size of response headers, bestie. that's the whole vibe. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <curl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HEADER_SIZE, long *sizep);
like, you pass the handle, you pass CURLINFO_HEADER_SIZE, you pass a long *sizep and boom β€” header size info is yours. no cap. πŸ’…

🌸 DESCRIPTION 🌸

so here's the tea: you pass a pointer to a long and it receives the total size of all the headers received. measured in number of bytes, periodt. πŸ”₯

and the total includes the size of any received headers that got suppressed by CURLOPT_SUPPRESS_CONNECT_HEADERS(3) β€” like, they're suppressed from view but they still count in this number, iykyk. πŸ™ˆ


🌈 PROTOCOLS 🌈

this functionality affects all supported protocols. all of them. every single one. main character energy for the entire protocol list. πŸ‘‘


πŸ“ EXAMPLE πŸ“

here's a whole little program, verbatim, don't touch the code bestie:

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
    result = curl_easy_perform(curl);
    if(result == CURLE_OK) {
      long size;
      result = curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &size);
      if(!result)
        printf("Header size: %ld bytes\n", size);
    }
    curl_easy_cleanup(curl);
  }
}

like look at it go 😭 it inits, it sets the CURLOPT_URL to "https://example.com", it performs, it gets the info, it prints "Header size: %ld bytes\n", it cleans up. ate and left no crumbs. πŸ’œ


⭐ AVAILABILITY ⭐

added in curl 7.4.1 β€” so she's been around a minute, a true veteran. 🫢


πŸ’€ RETURN VALUE πŸ’€

curl_easy_getinfo(3) returns a CURLcode indicating success or error. that's the whole contract, ngl.

  • CURLE_OK (0) β€” everything was OK, we love to see it ✨
  • non-zero β€” an error occurred 😭 see libcurl-errors(3) for the full breakdown

🧚 SEE ALSO 🧚

go read those too, bestie, they're all part of the same friend group πŸ’–


and that's the page! brought to you by libcurl, dated 2026-10-12, and yeah β€” this is CURLINFO_HEADER_SIZE(3), the manual page. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from