1CURLOPT_MAXFILESIZE_LARGE(3)curl_easy_setopt optionsCURLOPT_MAXFILESIZE_LARGE(3)
2
3
4
6 CURLOPT_MAXFILESIZE_LARGE - maximum file size allowed to download
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXFILESIZE_LARGE,
12 curl_off_t size);
13
15 Pass a curl_off_t as parameter. This allows you to specify the maximum
16 size (in bytes) of a file to download. If the file requested is found
17 larger than this value, the transfer will not start and CURLE_FILE‐
18 SIZE_EXCEEDED will be returned.
19
20 The file size is not always known prior to download, and for such files
21 this option has no effect even if the file transfer ends up being
22 larger than this given limit.
23
25 None
26
28 FTP, HTTP and MQTT
29
31 CURL *curl = curl_easy_init();
32 if(curl) {
33 CURLcode ret;
34 curl_off_t ridiculous = 1 << 48;
35 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
36 /* refuse to download if larger than ridiculous */
37 curl_easy_setopt(curl, CURLOPT_MAXFILESIZE_LARGE, ridiculous);
38 ret = curl_easy_perform(curl);
39 }
40
42 Added in 7.11.0
43
45 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
46 if not.
47
49 CURLOPT_MAXFILESIZE(3), CURLOPT_MAX_RECV_SPEED_LARGE(3),
50
51
52
53libcurl 7.79.1 July 23, 2021 CURLOPT_MAXFILESIZE_LARGE(3)