]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
docs: add CURLOPT_NOPROGRESS to CURLOPT_XFERINFOFUNCTION example
authorToon Claes <toon@iotcl.com>
Thu, 11 Apr 2024 11:45:25 +0000 (13:45 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 11 Apr 2024 13:59:53 +0000 (15:59 +0200)
It's important to set `CURLOPT_NOPROGRESS` to `0` if you want your
transfer callback function, set by `CURLOPT_XFERINFOFUNCTION`, getting
called. To emphasize this to the users, add this to the code example.

Closes #13348

docs/libcurl/opts/CURLOPT_XFERINFOFUNCTION.md

index 7fcd0e06d81728fbf71152843b2f799544b4b0fb..fd1fd2cb21056960983bd98209f4a82a63cbeee0 100644 (file)
@@ -104,6 +104,9 @@ int main(void)
     /* pass struct to callback  */
     curl_easy_setopt(curl, CURLOPT_XFERINFODATA, &data);
 
+    /* enable progress callback getting called */
+    curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
+
     curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, progress_callback);
   }
 }