GNURLOPT_M...SIZE_LARGE(3)
π
GNURLOPT_M...SIZE_LARGE(3) β CURLOPT_MAXFILESIZE_LARGE
okay so this page lives in the curl_easy_setopt options manual, and the manual name is literally GNURLOPT_M...SIZE_LARGE(3). The option weβre talking about is CURLOPT_MAXFILESIZE_LARGE, and itβs giving βset a max file size or elseβ energy. Letβs go β¨
πΈ NAME πΈ
CURLOPT_MAXFILESIZE_LARGEβ maximum file size allowed to download
β¨ SYNOPSIS β¨
The include and signature are locked in, no cap:
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXFILESIZE_LARGE,
curl_off_t size);
π DESCRIPTION π
You pass a curl_off_t as the parameter. Thatβs how you specify the maximum size (in bytes) of a file to download. If the requested file is found larger than this value, the transfer will not start, and CURLE_FILESIZE_EXCEEDED will be returned. Slay? More like slam the brakes π
important caveat, and I mean listen: the file size is not always known prior to download. For such files, this option has no effect, even if the file transfer ends up being larger than the given limit. This concerns both FTP and HTTP transfers. So itβs not a magical universal big-file blocker, bestie β itβs a βwhen we know the sizeβ situation.
π DEFAULT π
None. No default cap, no drama, just None.
π PROTOCOLS π
FTP and HTTP β thatβs the whole vibe check.
π¦ EXAMPLE π¦
Hereβs the example, copied exactly and looking iconic:
CURL *curl = curl_easy_init();
if(curl) {
CURLcode ret;
curl_off_t ridiculous = 1 << 48;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
/* refuse to download if larger than ridiculous */
curl_easy_setopt(curl, CURLOPT_MAXFILESIZE_LARGE, ridiculous);
ret = curl_easy_perform(curl);
}
β AVAILABILITY β
Added in 7.11.0. Vintage but still serving π
π RETURN VALUE π
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. Thatβs the whole return-value tea.
π₯ SEE ALSO π₯
Go read CURLOPT_MAXFILESIZE(3), CURLOPT_MAX_RECV_SPEED_LARGE(3), β and yes bestie, that trailing comma is in the original, leave it alone, itβs part of the lore. iykyk.
mwah π source/version: libcurl 7.37.0; date: 19 Jun 2014; manual name: GNURLOPT_M...SIZE_LARGE(3). Thatβs the footer folded cute, periodt. π«Ά
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms