diff options
Diffstat (limited to 'docs/libcurl/opts/CURLOPT_DEBUGDATA.3')
-rw-r--r-- | docs/libcurl/opts/CURLOPT_DEBUGDATA.3 | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/docs/libcurl/opts/CURLOPT_DEBUGDATA.3 b/docs/libcurl/opts/CURLOPT_DEBUGDATA.3 index 284e93a95..c205fd4b9 100644 --- a/docs/libcurl/opts/CURLOPT_DEBUGDATA.3 +++ b/docs/libcurl/opts/CURLOPT_DEBUGDATA.3 @@ -5,7 +5,7 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. +.\" * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al. .\" * .\" * This software is licensed as described in the file COPYING, which .\" * you should have received as part of this distribution. The terms @@ -20,10 +20,10 @@ .\" * .\" ************************************************************************** .\" -.TH CURLOPT_DEBUGDATA 3 "November 04, 2020" "libcurl 7.78.0" "curl_easy_setopt options" +.TH CURLOPT_DEBUGDATA 3 "November 08, 2021" "libcurl 7.80.0" "curl_easy_setopt options" .SH NAME -CURLOPT_DEBUGDATA \- custom pointer for debug callback +CURLOPT_DEBUGDATA \- pointer passed to the debug callback .SH SYNOPSIS #include <curl/curl.h> @@ -37,7 +37,31 @@ NULL .SH PROTOCOLS All .SH EXAMPLE -https://curl.se/libcurl/c/debug.html +.nf +int main(void) +{ + CURL *curl; + CURLcode res; + 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/"); + res = curl_easy_perform(curl); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + return 0; +} +.fi .SH AVAILABILITY Always .SH RETURN VALUE |