CURLINFO_REQUEST_SIZE(3)

πŸ’… CURLINFO_REQUEST_SIZE πŸ’…

okay so this is a page from the Library Functions Manual (libcurl girlies rise 🫢) and it's all about CURLINFO_REQUEST_SIZE β€” the size of the request you sent out into the world ✨


🌸 NAME 🌸

CURLINFO_REQUEST_SIZE β€” literally just the size of the sent request, that's it, that's the whole vibe πŸ’–


✨ SYNOPSIS ✨

#include <curl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REQUEST_SIZE, long *sizep);

πŸŽ€ DESCRIPTION πŸŽ€

bestie, here's the tea β˜• β€” you pass in a pointer to a long, and it comes back stuffed with the total size of the issued requests. slay.

ngl this one is so far only for HTTP requests, so don't come for her about other protocols ok 😭

also heads up πŸ‘€ β€” this may be more than one request if CURLOPT_FOLLOWLOCATION(3) is enabled. like she'll follow the redirects and the number just keeps growing, main character energy fr fr πŸ”₯


πŸ¦‹ PROTOCOLS πŸ¦‹

this functionality affects all supported protocols β€” every single one, no cap πŸ‘‘


⭐ EXAMPLE ⭐

here's the whole thing, verbatim, copy-paste her and she'll eat πŸ’…

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
    result = curl_easy_perform(curl);
    if(result == CURLE_OK) {
      long req;
      result = curl_easy_getinfo(curl, CURLINFO_REQUEST_SIZE, &req);
      if(!result)
        printf("Request size: %ld bytes\n", req);
    }
    curl_easy_cleanup(curl);
  }
}

🌈 AVAILABILITY 🌈

added in curl 7.4.1 β€” she's been iconic since day one, vintage queen πŸŽ€


πŸ’œ RETURN VALUE πŸ’œ

curl_easy_getinfo(3) returns a CURLcode indicating success or error, bestie. that's the whole report card πŸ“

  • CURLE_OK (0) means everything was OK β€” we love a zero, we stan a zero βœ…
  • non-zero means an error occurred 😭 go check libcurl-errors(3) for the full scoop

πŸ”₯ SEE ALSO πŸ”₯

go read them, iykyk πŸ“šβœ¨


ok that's the whole page diva, go measure some requests and be iconic about it πŸ’…πŸŒΈ

and that's a wrap from libcurl, dated 2026-10-12 β€” mwah, drink some water, ily πŸ«ΆπŸ’–

πŸ“¦ where this page comes from