]> granicus.if.org Git - transmission/commitdiff
(trunk libT) improve the debugging message that logs an http announce response
authorJordan Lee <jordan@transmissionbt.com>
Sat, 30 Jul 2011 22:40:15 +0000 (22:40 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Sat, 30 Jul 2011 22:40:15 +0000 (22:40 +0000)
libtransmission/announcer-http.c

index 241b881d4788bc49b1efd76b69e5fd30f1375992..33b82565cb30d8ffc3d1b9d57d9a0565cd1fcf93 100644 (file)
@@ -211,9 +211,17 @@ on_announce_done( tr_session   * session,
 
         if( getenv( "TR_CURL_VERBOSE" ) != NULL )
         {
-            struct evbuffer * buf = tr_bencToBuf( &benc, TR_FMT_JSON );
-            fprintf( stderr, "Announce response:\n< %s\n", evbuffer_pullup( buf, -1 ) );
-            tr_free( buf );
+            if( !benc_loaded )
+                fprintf( stderr, "%s", "Announce response was not in benc format\n" );
+            else {
+                int i, len;
+                char * str = tr_bencToStr( &benc, TR_FMT_JSON, &len );
+                fprintf( stderr, "%s", "Announce response:\n< " );
+                for( i=0; i<len; ++i )
+                    fputc( str[i], stderr );
+                fputc( '\n', stderr );
+                tr_free( str );
+            }
         }
 
         if( benc_loaded && tr_bencIsDict( &benc ) )