CURLOPT_DEBUGDATA(3)
π CURLOPT_DEBUGDATA β pointer passed to the debug callback π
okay bestie, welcome to the CURLOPT_DEBUGDATA(3) page from the Library Functions Manual β¨ this one is short, sweet, and honestly kinda iconic: it's all about handing your fave debug callback a little pointer of your very own π«Ά
β¨ NAME β¨
CURLOPT_DEBUGDATA β a pointer that gets passed straight to the debug callback π
πΈ SYNOPSIS πΈ
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DEBUGDATA, void *pointer);
π¦ DESCRIPTION π¦
So here's the vibe: you pass in a pointer to literally whatever you want, and libcurl hands that same pointer to your CURLOPT_DEBUGFUNCTION(3) as its last void * argument π«
That's it. That's the whole job. libcurl does not use this pointer itself β it just passes it along to the callback, no cap π
π DEFAULT π
NULL
π PROTOCOLS π
This functionality affects all supported protocols β¨
π EXAMPLE π
struct data {
void *custom;
};
static int my_trace(CURL *handle, curl_infotype type,
char *data, size_t size,
void *clientp)
{
struct data *mine = clientp;
printf("our ptr: %p\n", mine->custom);
/* output debug info */
return 0;
}
int main(void)
{
CURL *curl;
CURLcode result;
struct data my_tracedata;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace);
curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &my_tracedata);
/* the DEBUGFUNCTION has no effect until we enable VERBOSE */
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
result = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}
β AVAILABILITY β
Added in curl 7.9.6 π§
π₯ RETURN VALUE π₯
curl_easy_setopt(3) returns a CURLcode indicating success or error π
CURLE_OK (0) means everything was OK β slay. A non-zero value means an error occurred, so go check libcurl-errors(3) bestie π
π SEE ALSO π
that's the whole page, bestie β short, useful, and lowkey adorable π this little icon was brought to you by libcurl, dated 2026-10-12, and yes she ate πβ¨
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms