CURLOPT_DEBUGDATA.3 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. .\" generated by cd2nroff 0.1 from CURLOPT_DEBUGDATA.md
  2. .TH CURLOPT_DEBUGDATA 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_DEBUGDATA \- pointer passed to the debug callback
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DEBUGDATA, void *pointer);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a \fIpointer\fP to whatever you want passed in to your
  12. \fICURLOPT_DEBUGFUNCTION(3)\fP in the last void * argument. This pointer is
  13. not used by libcurl, it is only passed to the callback.
  14. .SH DEFAULT
  15. NULL
  16. .SH PROTOCOLS
  17. This functionality affects all supported protocols
  18. .SH EXAMPLE
  19. .nf
  20. struct data {
  21. void *custom;
  22. };
  23. static int my_trace(CURL *handle, curl_infotype type,
  24. char *data, size_t size,
  25. void *clientp)
  26. {
  27. struct data *mine = clientp;
  28. printf("our ptr: %p\\n", mine->custom);
  29. /* output debug info */
  30. }
  31. int main(void)
  32. {
  33. CURL *curl;
  34. CURLcode res;
  35. struct data my_tracedata;
  36. curl = curl_easy_init();
  37. if(curl) {
  38. curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace);
  39. curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &my_tracedata);
  40. /* the DEBUGFUNCTION has no effect until we enable VERBOSE */
  41. curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
  42. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  43. res = curl_easy_perform(curl);
  44. /* always cleanup */
  45. curl_easy_cleanup(curl);
  46. }
  47. return 0;
  48. }
  49. .fi
  50. .SH AVAILABILITY
  51. Added in curl 7.9.6
  52. .SH RETURN VALUE
  53. Returns CURLE_OK
  54. .SH SEE ALSO
  55. .BR CURLOPT_DEBUGFUNCTION (3),
  56. .BR CURLOPT_STDERR (3)