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. This concerns both FTP and HTTP trans‐
23 fers.
24
26 None
27
29 FTP and HTTP
30
32 CURL *curl = curl_easy_init();
33 if(curl) {
34 CURLcode ret;
35 curl_off_t ridiculous = 1 << 48;
36 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
37 /* refuse to download if larger than ridiculous */
38 curl_easy_setopt(curl, CURLOPT_MAXFILESIZE_LARGE, ridiculous);
39 ret = curl_easy_perform(curl);
40 }
41
43 Added in 7.11.0
44
46 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
47 if not.
48
50 CURLOPT_MAXFILESIZE(3), CURLOPT_MAX_RECV_SPEED_LARGE(3),
51
52
53
54libcurl 7.71.1 May 30, 2017 CURLOPT_MAXFILESIZE_LARGE(3)