]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
CURLOPT_MAXFILESIZE: clarify this also works for on-going transfers
authorDaniel Stenberg <daniel@haxx.se>
Wed, 13 May 2026 06:58:04 +0000 (08:58 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 13 May 2026 07:45:33 +0000 (09:45 +0200)
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
docs/libcurl/opts/CURLOPT_MAXFILESIZE_LARGE.md

index 17c4c9f4e176ddaa8f3a64362f6b667b60ec6937..a1a0d8496ccde8391be875b66214bd40b5a1a4cc 100644 (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.
index 791b25862f7e302c3960b3a00d953701e04468b1..929bae67f2c1fce494617ac06f2254267c5d9633 100644 (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.