From: Daniel Stenberg Date: Wed, 21 Aug 2024 21:35:31 +0000 (+0200) Subject: CURLOPT_XFERINFOFUNCTION: clarify the callback return codes X-Git-Tag: curl-8_10_0~164 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b000cdfb2c032805c7615c91b91f3f7c02c89c88;p=thirdparty%2Fcurl.git CURLOPT_XFERINFOFUNCTION: clarify the callback return codes also done in CURLOPT_PROGRESSFUNCTION.md This changes the wording to say that 1 should be returned instad of non-zero to return error from the callback. I did this to simplify, even if other non-zero values still do the same thing I figure we might just as well just leave out the others from the documentation. Fixes #14627 Reported-by: Benjamin Riefenstahl Mecom Closes #14637 --- diff --git a/docs/libcurl/opts/CURLOPT_PROGRESSFUNCTION.md b/docs/libcurl/opts/CURLOPT_PROGRESSFUNCTION.md index d9a24382be..eb0981e04f 100644 --- a/docs/libcurl/opts/CURLOPT_PROGRESSFUNCTION.md +++ b/docs/libcurl/opts/CURLOPT_PROGRESSFUNCTION.md @@ -60,11 +60,13 @@ if you only download data, the upload size remains 0). Many times the callback is called one or more times first, before it knows the data sizes so a program must be made to handle that. +Return zero from the callback if everything is fine. + If your callback function returns CURL_PROGRESSFUNC_CONTINUE it causes libcurl to continue executing the default progress function. -Returning any other non-zero value from this callback makes libcurl abort the -transfer and return *CURLE_ABORTED_BY_CALLBACK*. +Return 1 from this callback to make libcurl abort the transfer and return +*CURLE_ABORTED_BY_CALLBACK*. If you transfer data with the multi interface, this function is not called during periods of idleness unless you call the appropriate libcurl function diff --git a/docs/libcurl/opts/CURLOPT_XFERINFOFUNCTION.md b/docs/libcurl/opts/CURLOPT_XFERINFOFUNCTION.md index a7c130a506..e2f95371a1 100644 --- a/docs/libcurl/opts/CURLOPT_XFERINFOFUNCTION.md +++ b/docs/libcurl/opts/CURLOPT_XFERINFOFUNCTION.md @@ -56,12 +56,14 @@ you only download data, the upload size remains 0). Many times the callback is called one or more times first, before it knows the data sizes so a program must be made to handle that. +Return zero from the callback if everything is fine. + +Return 1 from this callback to make libcurl abort the transfer and return +*CURLE_ABORTED_BY_CALLBACK*. + If your callback function returns CURL_PROGRESSFUNC_CONTINUE it makes libcurl to continue executing the default progress function. -Returning any other non-zero value from this callback makes libcurl abort the -transfer and return *CURLE_ABORTED_BY_CALLBACK*. - If you transfer data with the multi interface, this function is not called during periods of idleness unless you call the appropriate libcurl function that performs transfers.