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