quickjs-tart

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

CURLOPT_MAXFILESIZE_LARGE.md (1778B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_MAXFILESIZE_LARGE
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLOPT_MAXFILESIZE (3)
      9   - CURLOPT_MAX_RECV_SPEED_LARGE (3)
     10 Protocol:
     11   - FTP
     12   - HTTP
     13   - MQTT
     14 Added-in: 7.11.0
     15 ---
     16 
     17 # NAME
     18 
     19 CURLOPT_MAXFILESIZE_LARGE - maximum file size allowed to download
     20 
     21 # SYNOPSIS
     22 
     23 ~~~c
     24 #include <curl/curl.h>
     25 
     26 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXFILESIZE_LARGE,
     27                           curl_off_t size);
     28 ~~~
     29 
     30 # DESCRIPTION
     31 
     32 Pass a curl_off_t as parameter. This specifies the maximum accepted *size*
     33 (in bytes) of a file to download. If the file requested is found larger than
     34 this value, the transfer is aborted and *CURLE_FILESIZE_EXCEEDED* is
     35 returned. Passing a zero *size* disables this, and passing a negative *size*
     36 yields a *CURLE_BAD_FUNCTION_ARGUMENT*.
     37 
     38 The file size is not always known prior to the download start, and for such
     39 transfers this option has no effect - even if the file transfer eventually
     40 ends up being larger than this given limit.
     41 
     42 Since 8.4.0, this option also stops ongoing transfers if they reach this
     43 threshold.
     44 
     45 # DEFAULT
     46 
     47 0, meaning disabled.
     48 
     49 # %PROTOCOLS%
     50 
     51 # EXAMPLE
     52 
     53 ~~~c
     54 int main(void)
     55 {
     56   CURL *curl = curl_easy_init();
     57   if(curl) {
     58     CURLcode ret;
     59     curl_off_t ridiculous = (curl_off_t)1 << 48;
     60     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
     61     /* refuse to download if larger than ridiculous */
     62     curl_easy_setopt(curl, CURLOPT_MAXFILESIZE_LARGE, ridiculous);
     63     ret = curl_easy_perform(curl);
     64   }
     65 }
     66 ~~~
     67 
     68 # %AVAILABILITY%
     69 
     70 # RETURN VALUE
     71 
     72 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     73 
     74 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     75 libcurl-errors(3).