quickjs-tart

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

CURLOPT_UPLOAD_BUFFERSIZE.md (1915B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_UPLOAD_BUFFERSIZE
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLOPT_BUFFERSIZE (3)
      9   - CURLOPT_READFUNCTION (3)
     10   - CURLOPT_TCP_NODELAY (3)
     11 Protocol:
     12   - All
     13 Added-in: 7.62.0
     14 ---
     15 
     16 # NAME
     17 
     18 CURLOPT_UPLOAD_BUFFERSIZE - upload buffer size
     19 
     20 # SYNOPSIS
     21 
     22 ~~~c
     23 #include <curl/curl.h>
     24 
     25 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UPLOAD_BUFFERSIZE, long size);
     26 ~~~
     27 
     28 # DESCRIPTION
     29 
     30 Pass a long specifying your preferred *size* (in bytes) for the upload
     31 buffer in libcurl. It makes libcurl uses a larger buffer that gets passed to
     32 the next layer in the stack to get sent off. In some setups and for some
     33 protocols, there is a huge performance benefit of having a larger upload
     34 buffer.
     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 The upload buffer size is by default 64 kilobytes. The maximum buffer size
     40 allowed to be set is 2 megabytes. The minimum buffer size allowed to be set is
     41 16 kilobytes.
     42 
     43 The upload buffer is allocated on-demand - so if the handle is not used for
     44 upload, this buffer is not allocated at all.
     45 
     46 DO NOT set this option on a handle that is currently used for an active
     47 transfer as that may lead to unintended consequences.
     48 
     49 # DEFAULT
     50 
     51 65536 bytes
     52 
     53 # %PROTOCOLS%
     54 
     55 # EXAMPLE
     56 
     57 ~~~c
     58 int main(void)
     59 {
     60   CURL *curl = curl_easy_init();
     61   if(curl) {
     62     CURLcode res;
     63     curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/foo.bin");
     64 
     65     /* ask libcurl to allocate a larger upload buffer */
     66     curl_easy_setopt(curl, CURLOPT_UPLOAD_BUFFERSIZE, 120000L);
     67 
     68     res = curl_easy_perform(curl);
     69 
     70     curl_easy_cleanup(curl);
     71   }
     72 }
     73 ~~~
     74 
     75 # %AVAILABILITY%
     76 
     77 # RETURN VALUE
     78 
     79 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     80 
     81 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     82 libcurl-errors(3).