Revert "Imported Upstream version 7.44.0"
[platform/upstream/curl.git] / docs / libcurl / opts / CURLOPT_DEBUGFUNCTION.html
index 2b5b633..ab3950b 100644 (file)
@@ -4,20 +4,15 @@
 <title>CURLOPT_DEBUGFUNCTION man page</title>
 <meta name="generator" content="roffit">
 <STYLE type="text/css">
-pre {
-  overflow: auto;
-  margin: 0;
-}
-
-P.level0, pre.level0 {
+P.level0 {
  padding-left: 2em;
 }
 
-P.level1, pre.level1 {
+P.level1 {
  padding-left: 4em;
 }
 
-P.level2, pre.level2 {
+P.level2 {
  padding-left: 6em;
 }
 
@@ -52,29 +47,26 @@ p.roffit {
 
 <p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2>
 <p class="level0">CURLOPT_DEBUGFUNCTION - debug callback <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2>
-<p class="level0"><pre class="level0">
-&#35;include &lt;curl/curl.h&gt;
-&nbsp;
-typedef enum {
-&nbsp; CURLINFO_TEXT = 0,
-&nbsp; CURLINFO_HEADER_IN,    /* 1 */
-&nbsp; CURLINFO_HEADER_OUT,   /* 2 */
-&nbsp; CURLINFO_DATA_IN,      /* 3 */
-&nbsp; CURLINFO_DATA_OUT,     /* 4 */
-&nbsp; CURLINFO_SSL_DATA_IN,  /* 5 */
-&nbsp; CURLINFO_SSL_DATA_OUT, /* 6 */
-&nbsp; CURLINFO_END
-} curl_infotype;
-&nbsp;
-int debug_callback(CURL *handle,
-&nbsp;                  curl_infotype type,
-&nbsp;                  char *data,
-&nbsp;                  size_t size,
-&nbsp;                  void *userptr);
-&nbsp;
-CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DEBUGFUNCTION,
-&nbsp;                         debug_callback);
-</pre>
+<p class="level0"><pre>
+<p class="level0">#include &lt;curl/curl.h&gt;
+ <p class="level0">typedef enum {
+ &nbsp; CURLINFO_TEXT = 0,
+ &nbsp; CURLINFO_HEADER_IN,    /* 1 */
+ &nbsp; CURLINFO_HEADER_OUT,   /* 2 */
+ &nbsp; CURLINFO_DATA_IN,      /* 3 */
+ &nbsp; CURLINFO_DATA_OUT,     /* 4 */
+ &nbsp; CURLINFO_SSL_DATA_IN,  /* 5 */
+ &nbsp; CURLINFO_SSL_DATA_OUT, /* 6 */
+ &nbsp; CURLINFO_END
+ } curl_infotype;
+ <p class="level0">int debug_callback(CURL *handle,
+ &nbsp;                  curl_infotype type,
+ &nbsp;                  char *data,
+ &nbsp;                  size_t size,
+ &nbsp;                  void *userptr);
+ <p class="level0">CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DEBUGFUNCTION,
+ &nbsp;                         debug_callback);
+ </pre>
 <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2>
 <p class="level0">Pass a pointer to your callback function, which should match the prototype shown above. 
 <p class="level0"><a Class="emphasis" href="./CURLOPT_DEBUGFUNCTION.html">CURLOPT_DEBUGFUNCTION</a> replaces the standard debug function used when <a Class="emphasis" href="./CURLOPT_VERBOSE.html">CURLOPT_VERBOSE</a> is in effect. This callback receives debug information, as specified in the <span Class="emphasis">type</span> argument. This function must return 0. The <span Class="emphasis">data</span> pointed to by the char * passed to this function WILL NOT be zero terminated, but will be exactly of the <span Class="emphasis">size</span> as told by the <span Class="emphasis">size</span> argument. 
@@ -96,103 +88,88 @@ CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DEBUGFUNCTION,
 <p class="level1">The data is SSL/TLS (binary) data received from the peer. <a name="DEFAULT"></a><h2 class="nroffsh">DEFAULT</h2>
 <p class="level0">NULL <a name="PROTOCOLS"></a><h2 class="nroffsh">PROTOCOLS</h2>
 <p class="level0">All <a name="EXAMPLE"></a><h2 class="nroffsh">EXAMPLE</h2>
-<p class="level0"><pre class="level0">
-static
-void dump(const char *text,
-&nbsp;         FILE *stream, unsigned char *ptr, size_t size)
-{
-&nbsp; size_t i;
-&nbsp; size_t c;
-&nbsp; unsigned int width=0x10;
-&nbsp;
-&nbsp; fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)n",
-&nbsp;         text, (long)size, (long)size);
-&nbsp;
-&nbsp; for(i=0; i&lt;size; i+= width) {
-&nbsp;   fprintf(stream, "%4.4lx: ", (long)i);
-&nbsp;
-&nbsp;   /* show hex to the left */
-&nbsp;   for(c = 0; c &lt; width; c++) {
-&nbsp;     if(i+c &lt; size)
-&nbsp;       fprintf(stream, "%02x ", ptr[i+c]);
-&nbsp;     else
-&nbsp;       fputs("   ", stream);
-&nbsp;   }
-&nbsp;
-&nbsp;   /* show data on the right */
-&nbsp;   for(c = 0; (c &lt; width) && (i+c &lt; size); c++)
-&nbsp;     fputc(ptr[i+c]&gt;=0x20) && (ptr[i+c]&lt;0x80)?ptr[i+c]:'.', stream);
-&nbsp;
-&nbsp;   fputc('n', stream); /* newline */
-&nbsp; }
-}
-&nbsp;
-static
-int my_trace(CURL *handle, curl_infotype type,
-&nbsp;            char *data, size_t size,
-&nbsp;            void *userp)
-{
-&nbsp; const char *text;
-&nbsp; (void)handle; /* prevent compiler warning */
-&nbsp;
-&nbsp; switch (type) {
-&nbsp; case CURLINFO_TEXT:
-&nbsp;   fprintf(stderr, "== Info: %s", data);
-&nbsp; default: /* in case a new one is introduced to shock us */
-&nbsp;   return 0;
-&nbsp;
-&nbsp; case CURLINFO_HEADER_OUT:
-&nbsp;   text = "=&gt; Send header";
-&nbsp;   break;
-&nbsp; case CURLINFO_DATA_OUT:
-&nbsp;   text = "=&gt; Send data";
-&nbsp;   break;
-&nbsp; case CURLINFO_SSL_DATA_OUT:
-&nbsp;   text = "=&gt; Send SSL data";
-&nbsp;   break;
-&nbsp; case CURLINFO_HEADER_IN:
-&nbsp;   text = "&lt;= Recv header";
-&nbsp;   break;
-&nbsp; case CURLINFO_DATA_IN:
-&nbsp;   text = "&lt;= Recv data";
-&nbsp;   break;
-&nbsp; case CURLINFO_SSL_DATA_IN:
-&nbsp;   text = "&lt;= Recv SSL data";
-&nbsp;   break;
-&nbsp; }
-&nbsp;
-&nbsp; dump(text, stderr, (unsigned char *)data, size);
-&nbsp; return 0;
-}
-&nbsp;
-int main(void)
-{
-&nbsp; CURL *curl;
-&nbsp; CURLcode res;
-&nbsp;
-&nbsp; curl = curl_easy_init();
-&nbsp; if(curl) {
-&nbsp;   curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace);
-&nbsp;
-&nbsp;   /* the DEBUGFUNCTION has no effect until we enable VERBOSE */
-&nbsp;   curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
-&nbsp;
-&nbsp;   /* example.com is redirected, so we tell libcurl to follow redirection */
-&nbsp;   curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
-&nbsp;
-&nbsp;   curl_easy_setopt(curl, CURLOPT_URL, "<a href="http://example.com/">http://example.com/</a>");
-&nbsp;   res = curl_easy_perform(curl);
-&nbsp;   /* Check for errors */
-&nbsp;   if(res != CURLE_OK)
-&nbsp;     fprintf(stderr, "curl_easy_perform() failed: %sn",
-&nbsp;             curl_easy_strerror(res));
-&nbsp;
-&nbsp;   /* always cleanup */
-&nbsp;   curl_easy_cleanup(curl);
-&nbsp; }
-&nbsp; return 0;
-}
-</pre>
+<p class="level0"><pre>
+<p class="level0">static
+ void dump(const char *text,
+ &nbsp;         FILE *stream, unsigned char *ptr, size_t size)
+ {
+ &nbsp; size_t i;
+ &nbsp; size_t c;
+ &nbsp; unsigned int width=0x10;
+ <p class="level0">&nbsp; fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)n",
+ &nbsp;         text, (long)size, (long)size);
+ <p class="level0">&nbsp; for(i=0; i&lt;size; i+= width) {
+ &nbsp;   fprintf(stream, "%4.4lx: ", (long)i);
+ <p class="level0">&nbsp;   /* show hex to the left */
+ &nbsp;   for(c = 0; c &lt; width; c++) {
+ &nbsp;     if(i+c &lt; size)
+ &nbsp;       fprintf(stream, "%02x ", ptr[i+c]);
+ &nbsp;     else
+ &nbsp;       fputs("   ", stream);
+ &nbsp;   }
+ <p class="level0">&nbsp;   /* show data on the right */
+ &nbsp;   for(c = 0; (c &lt; width) && (i+c &lt; size); c++)
+ &nbsp;     fputc(ptr[i+c]&gt;=0x20) && (ptr[i+c]&lt;0x80)?ptr[i+c]:'.', stream);
+ <p class="level0">&nbsp;   fputc('n', stream); /* newline */
+ &nbsp; }
+ }
+ <p class="level0">static
+ int my_trace(CURL *handle, curl_infotype type,
+ &nbsp;            char *data, size_t size,
+ &nbsp;            void *userp)
+ {
+ &nbsp; const char *text;
+ &nbsp; (void)handle; /* prevent compiler warning */
+ <p class="level0">&nbsp; switch (type) {
+ &nbsp; case CURLINFO_TEXT:
+ &nbsp;   fprintf(stderr, "== Info: %s", data);
+ &nbsp; default: /* in case a new one is introduced to shock us */
+ &nbsp;   return 0;
+ <p class="level0">&nbsp; case CURLINFO_HEADER_OUT:
+ &nbsp;   text = "=&gt; Send header";
+ &nbsp;   break;
+ &nbsp; case CURLINFO_DATA_OUT:
+ &nbsp;   text = "=&gt; Send data";
+ &nbsp;   break;
+ &nbsp; case CURLINFO_SSL_DATA_OUT:
+ &nbsp;   text = "=&gt; Send SSL data";
+ &nbsp;   break;
+ &nbsp; case CURLINFO_HEADER_IN:
+ &nbsp;   text = "&lt;= Recv header";
+ &nbsp;   break;
+ &nbsp; case CURLINFO_DATA_IN:
+ &nbsp;   text = "&lt;= Recv data";
+ &nbsp;   break;
+ &nbsp; case CURLINFO_SSL_DATA_IN:
+ &nbsp;   text = "&lt;= Recv SSL data";
+ &nbsp;   break;
+ &nbsp; }
+ <p class="level0">&nbsp; dump(text, stderr, (unsigned char *)data, size);
+ &nbsp; return 0;
+ }
+ <p class="level0">int main(void)
+ {
+ &nbsp; CURL *curl;
+ &nbsp; CURLcode res;
+ <p class="level0">&nbsp; curl = curl_easy_init();
+ &nbsp; if(curl) {
+ &nbsp;   curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace);
+ <p class="level0">&nbsp;   /* the DEBUGFUNCTION has no effect until we enable VERBOSE */
+ &nbsp;   curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
+ <p class="level0">&nbsp;   /* example.com is redirected, so we tell libcurl to follow redirection */
+ &nbsp;   curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
+ <p class="level0">&nbsp;   curl_easy_setopt(curl, CURLOPT_URL, "<a href="http://example.com/">http://example.com/</a>");
+ &nbsp;   res = curl_easy_perform(curl);
+ &nbsp;   /* Check for errors */
+ &nbsp;   if(res != CURLE_OK)
+ &nbsp;     fprintf(stderr, "curl_easy_perform() failed: %sn",
+ &nbsp;             curl_easy_strerror(res));
+ <p class="level0">&nbsp;   /* always cleanup */
+ &nbsp;   curl_easy_cleanup(curl);
+ &nbsp; }
+ &nbsp; return 0;
+ }
+ </pre>
 
 <p class="level0"><a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2>
 <p class="level0">Always <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2>