1CURLOPT_UPLOAD_BUFFERSIZE(3)curl_easy_setopt optionsCURLOPT_UPLOAD_BUFFERSIZE(3)
2
3
4
6 CURLOPT_UPLOAD_BUFFERSIZE - upload buffer size
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UPLOAD_BUFFERSIZE, long size);
12
14 Pass a long specifying your preferred size (in bytes) for the upload
15 buffer in libcurl. It makes libcurl uses a larger buffer that gets
16 passed to the next layer in the stack to get sent off. In some setups
17 and for some protocols, there's a huge performance benefit of having a
18 larger upload buffer.
19
20 This is just treated as a request, not an order. You cannot be guaranā
21 teed to actually get the given size.
22
23 The upload buffer size is by default 64 kilobytes. The maximum buffer
24 size allowed to be set is 2 megabytes. The minimum buffer size allowed
25 to be set is 16 kilobytes.
26
27 Since curl 7.61.1 the upload buffer is allocated on-demand - so if the
28 handle is not used for upload, this buffer will not be allocated at
29 all.
30
31 DO NOT set this option on a handle that is currently used for an active
32 transfer as that may lead to unintended consequences.
33
35 64 kB
36
38 All
39
41 CURL *curl = curl_easy_init();
42 if(curl) {
43 curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/foo.bin");
44
45 /* ask libcurl to allocate a larger upload buffer */
46 curl_easy_setopt(curl, CURLOPT_UPLOAD_BUFFERSIZE, 120000L);
47
48 ret = curl_easy_perform(curl);
49
50 curl_easy_cleanup(curl);
51 }
52
54 Added in 7.62.0.
55
57 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
58 if not.
59
61 CURLOPT_BUFFERSIZE(3), CURLOPT_READFUNCTION(3),
62
63
64
65libcurl 7.82.0 November 26, 2021 CURLOPT_UPLOAD_BUFFERSIZE(3)