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 (10MB). The minimum
25       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
30       The maximum size was 512kB until 7.88.0.
31

DEFAULT

33       CURL_MAX_WRITE_SIZE (16kB)
34

PROTOCOLS

36       All
37

EXAMPLE

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

AVAILABILITY

52       Added in 7.10.  Growing the buffer was added in 7.53.0.
53

RETURN VALUE

55       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
56       if not.
57

SEE ALSO

59       CURLOPT_MAX_RECV_SPEED_LARGE(3), CURLOPT_WRITEFUNCTION(3),  CURLOPT_UP‐
60       LOAD_BUFFERSIZE(3),
61
62
63
64libcurl 8.0.1                  January 07, 2023          CURLOPT_BUFFERSIZE(3)
Impressum