quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_BUFFERSIZE.md (2146B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_BUFFERSIZE
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLOPT_MAXFILESIZE (3)
      9   - CURLOPT_MAX_RECV_SPEED_LARGE (3)
     10   - CURLOPT_UPLOAD_BUFFERSIZE (3)
     11   - CURLOPT_WRITEFUNCTION (3)
     12 Protocol:
     13   - All
     14 Added-in: 7.10
     15 ---
     16 
     17 # NAME
     18 
     19 CURLOPT_BUFFERSIZE - receive buffer size
     20 
     21 # SYNOPSIS
     22 
     23 ~~~c
     24 #include <curl/curl.h>
     25 
     26 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_BUFFERSIZE, long size);
     27 ~~~
     28 
     29 # DESCRIPTION
     30 
     31 Pass a long specifying your preferred *size* (in bytes) for the receive buffer
     32 in libcurl. The main point of this would be that the write callback gets
     33 called more often and with smaller chunks. Secondly, for some protocols, there
     34 is a benefit of having a larger buffer for performance.
     35 
     36 This is just treated as a request, not an order. You cannot be guaranteed to
     37 actually get the given size.
     38 
     39 This buffer size is by default *CURL_MAX_WRITE_SIZE* (16kB). The maximum
     40 buffer size allowed to be set is *CURL_MAX_READ_SIZE* (10MB). The minimum
     41 buffer size allowed to be set is 1024.
     42 
     43 DO NOT set this option on a handle that is currently used for an active
     44 transfer as that may lead to unintended consequences.
     45 
     46 The maximum size was 512kB until 7.88.0.
     47 
     48 Starting in libcurl 8.7.0, there is just a single transfer buffer allocated
     49 per multi handle. This buffer is used by all easy handles added to a multi
     50 handle no matter how many parallel transfers there are. The buffer remains
     51 allocated as long as there are active transfers.
     52 
     53 # DEFAULT
     54 
     55 CURL_MAX_WRITE_SIZE (16kB)
     56 
     57 # %PROTOCOLS%
     58 
     59 # EXAMPLE
     60 
     61 ~~~c
     62 int main(void)
     63 {
     64   CURL *curl = curl_easy_init();
     65   if(curl) {
     66     CURLcode res;
     67     curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/foo.bin");
     68 
     69     /* ask libcurl to allocate a larger receive buffer */
     70     curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 120000L);
     71 
     72     res = curl_easy_perform(curl);
     73 
     74     curl_easy_cleanup(curl);
     75   }
     76 }
     77 ~~~
     78 
     79 # %AVAILABILITY%
     80 
     81 # RETURN VALUE
     82 
     83 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     84 
     85 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     86 libcurl-errors(3).