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
14---
15
16# NAME
17
18CURLINFO_HEADER_SIZE - get size of retrieved headers
19
20# SYNOPSIS
21
22~~~c
23#include <curl/curl.h>
24
25CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HEADER_SIZE, long *sizep);
26~~~
27
28# DESCRIPTION
29
30Pass a pointer to a long to receive the total size of all the headers
31received. Measured in number of bytes.
32
33The total includes the size of any received headers suppressed by
34CURLOPT_SUPPRESS_CONNECT_HEADERS(3).
35
36# EXAMPLE
37
38~~~c
39int main(void)
40{
41  CURL *curl = curl_easy_init();
42  if(curl) {
43    CURLcode res;
44    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
45    res = curl_easy_perform(curl);
46    if(res == CURLE_OK) {
47      long size;
48      res = curl_easy_getinfo(curl, CURLINFO_HEADER_SIZE, &size);
49      if(!res)
50        printf("Header size: %ld bytes\n", size);
51    }
52    curl_easy_cleanup(curl);
53  }
54}
55~~~
56
57# AVAILABILITY
58
59Added in 7.4.1
60
61# RETURN VALUE
62
63Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
64