1--- 2c: Copyright (C) Daniel Stenberg, <daniel.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) 12--- 13 14# NAME 15 16CURLINFO_REQUEST_SIZE - get size of sent request 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REQUEST_SIZE, long *sizep); 24~~~ 25 26# DESCRIPTION 27 28Pass a pointer to a long to receive the total size of the issued 29requests. This is so far only for HTTP requests. Note that this may be more 30than one request if CURLOPT_FOLLOWLOCATION(3) is enabled. 31 32# PROTOCOLS 33 34All 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 req; 48 res = curl_easy_getinfo(curl, CURLINFO_REQUEST_SIZE, &req); 49 if(!res) 50 printf("Request size: %ld bytes\n", req); 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