1CURLOPT_BUFFERSIZE(3)      curl_easy_setopt options      CURLOPT_BUFFERSIZE(3)
2
3
4

NAME

6       CURLOPT_BUFFERSIZE - receive buffer size
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_BUFFERSIZE, long size);
12

DESCRIPTION

14       Pass  a  long specifying your preferred size (in bytes) for the receive
15       buffer in libcurl.  The main point of this  would  be  that  the  write
16       callback  gets called more often and with smaller chunks. Secondly, for
17       some protocols, there's a benefit of having a larger buffer for perfor‐
18       mance.
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       This buffer size is by default CURL_MAX_WRITE_SIZE (16kB). The  maximum
24       buffer  size allowed to be set is CURL_MAX_READ_SIZE (512kB). The mini‐
25       mum buffer size allowed to be set is 1024.
26
27       DO NOT set this option on a handle that is currently used for an active
28       transfer as that may lead to unintended consequences.
29

DEFAULT

31       CURL_MAX_WRITE_SIZE (16kB)
32

PROTOCOLS

34       All
35

EXAMPLE

37       CURL *curl = curl_easy_init();
38       if(curl) {
39         curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/foo.bin");
40
41         /* ask libcurl to allocate a larger receive buffer */
42         curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 120000L);
43
44         ret = curl_easy_perform(curl);
45
46         curl_easy_cleanup(curl);
47       }
48

AVAILABILITY

50       Added in 7.10.  Growing the buffer was added in 7.53.0.
51

RETURN VALUE

53       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
54       if not.
55

SEE ALSO

57       CURLOPT_MAX_RECV_SPEED_LARGE(3), CURLOPT_WRITEFUNCTION(3),  CURLOPT_UP‐
58       LOAD_BUFFERSIZE(3),
59
60
61
62libcurl 7.85.0                  August 23, 2022          CURLOPT_BUFFERSIZE(3)
Impressum