GNURLOPT_U...BUFFERSIZE(3)
π GNURLOPT_UPLOAD_BUFFERSIZE(3) β like, the upload-buffer-size one, bestie
okay so real talk, this one lives in the gnurl/curl.h corner of the world (that's the gnurl flavour of the curl_easy_setopt options crew, iykyk), and it's genuinely one of those "small flag, big mood" situations π«Ά
β¨ NAME β¨
CURLOPT_UPLOAD_BUFFERSIZE β set your preferred upload buffer size, queen π
πΈ SYNOPSIS πΈ
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UPLOAD_BUFFERSIZE, long size);
π¦ DESCRIPTION π¦
so you pass a long that says what size (in bytes, btw) you want the upload buffer in libcurl to be. and then libcurl goes and uses a bigger buffer that gets passed to the next layer down the stack so it can get sent off. and honestly? in some setups, and for some protocols, having a larger upload buffer is a huge performance benefit. like, not me being dramatic, it's literally in the docs. π₯
β οΈ but listen β this is treated as a request, not an order. you are not guaranteed to actually get the size you asked for. the vibes are advisory only. π
the upload buffer size is by default 64 kilobytes. the maximum buffer size you're allowed to set is 2 megabytes. the minimum buffer size you're allowed to set is 16 kilobytes. so like, stay in your lane between those, bestie π
and since curl 7.61.1 the upload buffer is allocated on-demand β so if the handle isn't used for upload, the buffer will not be allocated at all. we love a lazy-allocating icon who doesn't do work that isn't needed β¨
π DEFAULT π
64 kB β the standard-issue vibe, no cap
π PROTOCOLS π
All of them. every single one. main character energy across the board π
π EXAMPLE π
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/foo.bin");
/* ask libcurl to allocate a larger upload buffer */
curl_easy_setopt(curl, CURLOPT_UPLOAD_BUFFERSIZE, 120000L);
ret = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
see that 120000L? that's the "please give me a bigger buffer" ask π₯Ί and the comment in the middle is literally there to explain itself, we stan a self-documenting codebase.
β AVAILABILITY β
Added in 7.62.0. so if you're on something older, this option is giving "not invited to the party" π
π§ RETURN VALUE π§
returns CURLE_OK if the option is supported β slay β
and returns CURLE_UNKNOWN_OPTION if it's not β sad but valid π
π₯ SEE ALSO π₯
(that trailing comma in the original? iconic. we keep it. periodt.)
and that's the whole page, bestie π it's from libcurl 7.62.0, dated 18 Aug 2018, filed under the very dramatic GNURLOPT_U...BUFFERSIZE(3) header because apparently even manpage titles get the abridged treatment π go forth and buffer responsibly π¦
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2018, 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