1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLINFO_HEADER_SIZE 5Section: 3 6Source: libcurl 7See-also: 8 - CURLINFO_REQUEST_SIZE (3) 9 - CURLINFO_SIZE_DOWNLOAD (3) 10 - curl_easy_getinfo (3) 11 - curl_easy_setopt (3) 12Protocol: 13 - All 14Added-in: 7.4.1 15--- 16 17# NAME 18 19CURLINFO_HEADER_SIZE - get size of retrieved headers 20 21# SYNOPSIS 22 23~~~c 24#include <curl/curl.h> 25 26CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HEADER_SIZE, long *sizep); 27~~~ 28 29# DESCRIPTION 30 31Pass a pointer to a long to receive the total size of all the headers 32received. Measured in number of bytes. 33 34The total includes the size of any received headers suppressed by 35CURLOPT_SUPPRESS_CONNECT_HEADERS(3). 36 37# %PROTOCOLS% 38 39# EXAMPLE 40 41~~~c 42int main(void) 43{ 44 CURL *curl = curl_easy_init(); 45 if(curl) { 46 CURLcode res; 47 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 48 res = curl_easy_perform(curl); 49 if(res == CURLE_OK) { 50 long size; 51 res = curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &size); 52 if(!res) 53 printf("Header size: %ld bytes\n", size); 54 } 55 curl_easy_cleanup(curl); 56 } 57} 58~~~ 59 60# %AVAILABILITY% 61 62# RETURN VALUE 63 64Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 65