1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLINFO_REQUEST_SIZE
5Section: 3
6Source: libcurl
7See-also:
8  - CURLINFO_HEADER_SIZE (3)
9  - CURLINFO_SIZE_DOWNLOAD_T (3)
10  - curl_easy_getinfo (3)
11  - curl_easy_setopt (3)
12Protocol:
13  - All
14---
15
16# NAME
17
18CURLINFO_REQUEST_SIZE - get size of sent request
19
20# SYNOPSIS
21
22~~~c
23#include <curl/curl.h>
24
25CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REQUEST_SIZE, long *sizep);
26~~~
27
28# DESCRIPTION
29
30Pass a pointer to a long to receive the total size of the issued
31requests. This is so far only for HTTP requests. Note that this may be more
32than one request if CURLOPT_FOLLOWLOCATION(3) is enabled.
33
34# EXAMPLE
35
36~~~c
37int main(void)
38{
39  CURL *curl = curl_easy_init();
40  if(curl) {
41    CURLcode res;
42    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
43    res = curl_easy_perform(curl);
44    if(res == CURLE_OK) {
45      long req;
46      res = curl_easy_getinfo(curl, CURLINFO_REQUEST_SIZE, &req);
47      if(!res)
48        printf("Request size: %ld bytes\n", req);
49    }
50    curl_easy_cleanup(curl);
51  }
52}
53~~~
54
55# AVAILABILITY
56
57Added in 7.4.1
58
59# RETURN VALUE
60
61Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
62