CURLOPT_MAXFILESIZE: clarify this also works for on-going transfers

It was not really clear, but it has worked like this since 8.4.0 which
now is a while.

Closes #21582
This commit is contained in:
Daniel Stenberg 2026-05-13 08:58:04 +02:00
parent eca309c2a1
commit 89f38c168c
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 23 additions and 19 deletions

View file

@ -32,17 +32,16 @@ value, the transfer is aborted and *CURLE_FILESIZE_EXCEEDED* is returned.
Passing a zero *size* disables this, and passing a negative *size* yields a
*CURLE_BAD_FUNCTION_ARGUMENT*.
The file size is not always known prior to the download start, and for such
transfers this option has no effect - even if the file transfer eventually
ends up being larger than this given limit.
If you want a limit above 2GB, use CURLOPT_MAXFILESIZE_LARGE(3).
Since 8.4.0, this option also stops ongoing transfers if they reach this
threshold.
If the size is known to be too big before the transfer starts, libcurl
aborts before starting the transfer. If it is instead found to be too big
while the transfer is in progress, libcurl aborts the transfer once the
received bytes exceed the limit.
Since 8.20.0, this option also stops ongoing transfers that would reach this
threshold due to automatic decompression using CURLOPT_ACCEPT_ENCODING(3).
Since 8.20.0, this option also aborts ongoing transfers once the
decompressed bytes exceed this threshold due to automatic decompression using
CURLOPT_ACCEPT_ENCODING(3).
# DEFAULT
@ -68,6 +67,10 @@ int main(void)
# %AVAILABILITY%
# HISTORY
Before curl 8.4.0, the limit was not applied to transfers in progress.
# RETURN VALUE
curl_easy_setopt(3) returns a CURLcode indicating success or error.

View file

@ -29,18 +29,15 @@ CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXFILESIZE_LARGE,
# DESCRIPTION
Pass a curl_off_t as parameter. This specifies the maximum accepted *size*
(in bytes) of a file to download. If the file requested is found larger than
this value, the transfer is aborted and *CURLE_FILESIZE_EXCEEDED* is
returned. Passing a zero *size* disables this, and passing a negative *size*
yields a *CURLE_BAD_FUNCTION_ARGUMENT*.
Pass a curl_off_t as parameter. This specifies the maximum accepted *size* (in
bytes) of a file to download. If the file requested is found larger than this
value, the transfer is aborted and *CURLE_FILESIZE_EXCEEDED* is returned.
Passing a zero *size* disables this, and passing a negative *size* yields a
*CURLE_BAD_FUNCTION_ARGUMENT*.
The file size is not always known prior to the download start, and for such
transfers this option has no effect - even if the file transfer eventually
ends up being larger than this given limit.
Since 8.4.0, this option also stops ongoing transfers if they reach this
threshold.
If the size is known to exceed the limit before the transfer starts, libcurl
aborts before starting the transfer. If the transfer instead exceeds the limit
while it is in progress, libcurl aborts it at that point.
Since 8.20.0, this option also stops ongoing transfers that would reach this
threshold due to automatic decompression using CURLOPT_ACCEPT_ENCODING(3).
@ -70,6 +67,10 @@ int main(void)
# %AVAILABILITY%
# HISTORY
Before curl 8.4.0, the limit was not applied to transfers in progress.
# RETURN VALUE
curl_easy_setopt(3) returns a CURLcode indicating success or error.