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 thehandle, you passCURLINFO_HEADER_SIZE, you pass along *sizepand 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
- 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