GNURLOPT_P...SIZE_LARGE(3)
π GNURLOPT_POSTFIELDSIZE_LARGE β bestie's guide to the size of POST data pointed to π
Okay so this is a page from the gnurl manual, section 3 (GNURLOPT_P...SIZE_LARGE(3) β yes the title got squished by the terminal, she's fine) π
. Sit down, grab a strawberry drink π, and let's get into it.
β¨ NAME β¨
CURLOPT_POSTFIELDSIZE_LARGE β literally the size of the POST data you're pointing at π«Ά
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTFIELDSIZE_LARGE,
curl_off_t size);
That's the whole vibe. You pass a curl_off_t called size and she slays π¦
β¨ DESCRIPTION β¨
Okay so picture this: you wanna post data to the server, but you do not want libcurl running strlen() to measure how big your data is. Then this option is the one π. You must use it in that case β it's not optional, it's the whole point.
When you use this option, you can post fully binary data, which otherwise is likely to fail π (binary + strlen() = disaster, no cap).
And if you set this size to -1, the library goes back to using strlen() to get the size. Yep, back to the old ways π
β¨ DEFAULT β¨
-1
β¨ PROTOCOLS β¨
HTTP(S) π
β¨ EXAMPLE β¨
Here's the whole thing, copy it exactly bestie:
CURL *curl = curl_easy_init();
if(curl) {
const char *data = large_chunk;
curl_off_t length_of_data; /* set somehow */
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
/* size of the POST data */
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, length_of_data);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
curl_easy_perform(curl);
}
Notice the /* set somehow */ comment β that's not me being shady, that's literally what the page says. You gotta figure out that length yourself, bestie π§
β¨ AVAILABILITY β¨
She ships along with HTTP π
β¨ RETURN VALUE β¨
- Returns
CURLE_OKif HTTP is supported π - Returns
CURLE_UNKNOWN_OPTIONif it's not π
That's it, that's the whole check.
β¨ SEE ALSO β¨
(Yes, that last comma is living there rent free, and I'm not evicting her π)
tiny warning bb π«Ά β if you set a size that doesn't match your actual data, that's on you, not on me. This page only tells you what's written here, fr fr.
Okay that's the whole page, mwah π β this cutie is from libcurl 7.37.0, dated 17 Jun 2014, so show her some respect, she's been iconic since before some of y'all were born πΈπ
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms