CURLOPT_UPLOAD_BUFFERSIZE(3)
CURLOPT_UPLOAD_BUFFERSIZE(3) π β¨
okay so bestie, welcome to the Library Functions Manual β this is the whole vibe on CURLOPT_UPLOAD_BUFFERSIZE(3), and yes it is exactly as iconic as it sounds π«Ά
π NAME π
CURLOPT_UPLOAD_BUFFERSIZE β upload buffer size
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UPLOAD_BUFFERSIZE, long size);
π¦ DESCRIPTION π¦
Pass a long specifying your preferred size (in bytes) for the upload buffer in libcurl. It makes libcurl use a larger buffer that gets passed to the next layer in the stack to get sent off. In some setups and for some protocols, there is a huge performance benefit of having a larger upload buffer. like, actually huge, not just delulu hype β¨
This is just treated as a request, not an order. You cannot be guaranteed to actually get the given size. so don't come for libcurl if it doesn't match exactly, bestie π
The upload buffer size is by default 64 kilobytes. The maximum buffer size allowed to be set is 2 megabytes. The minimum buffer size allowed to be set is 16 kilobytes.
The upload buffer is allocated on-demand β so if the handle is not used for upload, this buffer is not allocated at all. slay, no wasted allocation energy π
π¨ DO NOT set this option on a handle that is currently used for an active transfer as that may lead to unintended consequences. fr fr, do not do it, this is not a drill π
π DEFAULT π
65536 bytes β that's the 64 kilobytes from above, bestie, we stay consistent π
π PROTOCOLS π
This functionality affects all supported protocols β all of them, every single one π«Ά
π₯ EXAMPLE π₯
okay here's the little C moment, copied exactly because we do not mess with code in this group chat π
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
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);
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
}
β AVAILABILITY β
Added in curl 7.62.0 β vintage but still serving β¨
π RETURN VALUE π
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3). so if it's not 0, go read that page, iykyk π§
π SEE ALSO π
go give these a read too, bestie β the lore is connected π
xoxo, this page is from libcurl, dated 2026-10-12 β now go set your buffer size with main character energy π«Άπ
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms