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