GNURLOPT_CHUNK_END_FUNCTION(3)
π GNURLOPT_CHUNK_END_FUNCTION(3) π
okay so you're on the curl_easy_setopt options manual page, and this particular icon is all about CURLOPT_CHUNK_END_FUNCTION. Bestie, it's the callback that happens after a transfer with FTP wildcardmatch. periodt. π
π NAME π
CURLOPT_CHUNK_END_FUNCTION β callback after a transfer with FTP wildcardmatch. π¦
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
long chunk_end_callback(void *ptr);
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CHUNK_END_FUNCTION,
chunk_end_callback);
πΈ DESCRIPTION πΈ
okay so the whole thing is: you pass a pointer to your callback function, and it should match the prototype shown above. No cap.
libcurl calls this function as soon as a part of the stream has been transferred (or skipped). That's the moment. β
When everything is fine, return CURL_CHUNK_END_FUNC_OK. If some error occurred and you need to tell the lib to stop, return CURL_CHUNK_END_FUNC_FAIL. That's the whole vibe check. π
π DEFAULT π
NULL β literally just NULL. No callback, no drama. π
π PROTOCOLS π
FTP β that's it, bestie. π
π EXAMPLE π
Here's the example in all its code-glory, literal and exact:
static long file_is_downloaded(struct callback_data *data)
{
if(data->output) {
fclose(data->output);
data->output = 0x0;
}
return CURL_CHUNK_END_FUNC_OK;
}
int main()
{
/* data for callback */
struct callback_data callback_info;
curl_easy_setopt(curl, CURLOPT_CHUNK_END_FUNCTION, file_is_downloaded);
curl_easy_setopt(curl, CURLOPT_CHUNK_DATA, &callback_info);
}
π AVAILABILITY π
Added in 7.21.0. She's been here a minute. β¨
π«Ά RETURN VALUE π«Ά
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. Simple as that. π
π¦ SEE ALSO π¦
peace out and happy wildcard matching, bestie π β this page is from libcurl 7.37.0, dated 19 Jun 2014. π«Ά
π¦ 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