CURLINFO_HEADER_SIZE.md (1353B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLINFO_HEADER_SIZE 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLINFO_REQUEST_SIZE (3) 9 - CURLINFO_SIZE_DOWNLOAD (3) 10 - curl_easy_getinfo (3) 11 - curl_easy_setopt (3) 12 Protocol: 13 - All 14 Added-in: 7.4.1 15 --- 16 17 # NAME 18 19 CURLINFO_HEADER_SIZE - get size of retrieved headers 20 21 # SYNOPSIS 22 23 ~~~c 24 #include <curl/curl.h> 25 26 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HEADER_SIZE, long *sizep); 27 ~~~ 28 29 # DESCRIPTION 30 31 Pass a pointer to a long to receive the total size of all the headers 32 received. Measured in number of bytes. 33 34 The total includes the size of any received headers suppressed by 35 CURLOPT_SUPPRESS_CONNECT_HEADERS(3). 36 37 # %PROTOCOLS% 38 39 # EXAMPLE 40 41 ~~~c 42 int 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 64 curl_easy_getinfo(3) returns a CURLcode indicating success or error. 65 66 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 67 libcurl-errors(3).