From 89f38c168cf5e898d099302b8ed0cec0f82c0415 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 13 May 2026 08:58:04 +0200 Subject: [PATCH] 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 --- docs/libcurl/opts/CURLOPT_MAXFILESIZE.md | 19 ++++++++------- .../libcurl/opts/CURLOPT_MAXFILESIZE_LARGE.md | 23 ++++++++++--------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/docs/libcurl/opts/CURLOPT_MAXFILESIZE.md b/docs/libcurl/opts/CURLOPT_MAXFILESIZE.md index 17c4c9f4e1..a1a0d8496c 100644 --- a/docs/libcurl/opts/CURLOPT_MAXFILESIZE.md +++ b/docs/libcurl/opts/CURLOPT_MAXFILESIZE.md @@ -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. diff --git a/docs/libcurl/opts/CURLOPT_MAXFILESIZE_LARGE.md b/docs/libcurl/opts/CURLOPT_MAXFILESIZE_LARGE.md index 791b25862f..929bae67f2 100644 --- a/docs/libcurl/opts/CURLOPT_MAXFILESIZE_LARGE.md +++ b/docs/libcurl/opts/CURLOPT_MAXFILESIZE_LARGE.md @@ -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.