cURL / Mailing Lists / curl-library / Single Mail

curl-library

Patch for tracing functionality - CURLINFO_ERROR in curl_infotype

From: Robert Iakobashvili <roberti_at_Go-WLAN.com>
Date: Wed, 24 Nov 2004 07:49:26 +0200


Hi alls,

We are used to trace the libcurl output to a file for troubleshooting of our setup and libcurl
problems, if any, using customized tracing function similar to docs/examples/debug.c my_trace.

The tracing output may be rather large and to figure out the errors we are using the following patch,
which may be useful for community as well. In brief the patch calls spades the spades and places CURLINFO_ERROR
curl_infotype on errors to mark them for futher searches.

diff -Nur curl-7.12.2/include/curl/curl.h curl-7.12.2-rob/include/curl/curl.h
--- curl-7.12.2/include/curl/curl.h 2004-10-08 10:06:16.000000000 +0200
+++ curl-7.12.2-rob/include/curl/curl.h 2004-11-22 14:45:52.597582240 +0200
@@ -178,6 +178,7 @@
   CURLINFO_DATA_OUT, /* 4 */
   CURLINFO_SSL_DATA_IN, /* 5 */
   CURLINFO_SSL_DATA_OUT, /* 6 */
+ CURLINFO_ERROR, /* 7 */
   CURLINFO_END
 } curl_infotype;

diff -Nur curl-7.12.2/lib/sendf.c curl-7.12.2-rob/lib/sendf.c
--- curl-7.12.2/lib/sendf.c 2004-10-18 00:21:02.000000000 +0200
+++ curl-7.12.2-rob/lib/sendf.c 2004-11-22 14:42:00.698836208 +0200
@@ -167,7 +167,8 @@
         data->set.errorbuffer[len] = '\n';
         data->set.errorbuffer[++len] = '\0';
       }
- Curl_debug(data, CURLINFO_TEXT, data->set.errorbuffer, len, NULL);
+ /*Curl_debug(data, CURLINFO_TEXT, data->set.errorbuffer, len, NULL);*/
+ Curl_debug(data, CURLINFO_ERROR, data->set.errorbuffer, len, NULL);
       if(doneit)
         /* cut off the newline again */
         data->set.errorbuffer[--len]=0;
@@ -449,7 +450,7 @@
                   char *ptr, size_t size)
 {
   static const char * const s_infotype[CURLINFO_END] = {
- "* ", "< ", "> ", "{ ", "} ", "{ ", "} " };
+ "* ", "< ", "> ", "{ ", "} ", "{ ", "} " "! "};

   if(data->set.fdebug)
     return (*data->set.fdebug)(data, type, ptr, size,
@@ -459,6 +460,7 @@
   case CURLINFO_TEXT:
   case CURLINFO_HEADER_OUT:
   case CURLINFO_HEADER_IN:
+ case CURLINFO_ERROR:
     fwrite(s_infotype[type], 2, 1, data->set.err);
     fwrite(ptr, size, 1, data->set.err);
     break;



Sincerely,
Robert Iakobashvili,
roberti_at_go-wlan.com
Received on 2004-11-24