1. fix #968: 'transmission-remote -r' deletes all
2. fix error in escaping control characters when serializing tr_benc to JSON
3. fix small memory leak in rpc command parsing
This commit is contained in:
Charles Kerr
2008-05-24 18:22:16 +00:00
parent 913b88c8b6
commit 0ab37e45d5
5 changed files with 79 additions and 41 deletions

View File

@@ -196,19 +196,19 @@ readargs( int argc, char ** argv )
break;
case 'r': tr_bencDictAddStr( &top, "method", "torrent-remove" );
if( strcmp( optarg, "all" ) )
tr_bencDictAddStr( args, "ids", optarg );
tr_rpc_parse_list_str( tr_bencDictAdd( args, "ids" ), optarg, strlen(optarg) );
break;
case 's': tr_bencDictAddStr( &top, "method", "torrent-start" );
if( strcmp( optarg, "all" ) )
tr_bencDictAddStr( args, "ids", optarg );
tr_rpc_parse_list_str( tr_bencDictAdd( args, "ids" ), optarg, strlen(optarg) );
break;
case 'S': tr_bencDictAddStr( &top, "method", "torrent-stop" );
if( strcmp( optarg, "all" ) )
tr_bencDictAddStr( args, "ids", optarg );
tr_rpc_parse_list_str( tr_bencDictAdd( args, "ids" ), optarg, strlen(optarg) );
break;
case 'v': tr_bencDictAddStr( &top, "method", "torrent-verify" );
if( strcmp( optarg, "all" ) )
tr_bencDictAddStr( args, "ids", optarg );
tr_rpc_parse_list_str( tr_bencDictAdd( args, "ids" ), optarg, strlen(optarg) );
break;
default:
showUsage( );
@@ -340,6 +340,8 @@ processRequests( const char * host, int port,
{
CURLcode res;
curl_easy_setopt( curl, CURLOPT_POSTFIELDS, reqs[i] );
if( debug )
tr_ninf( MY_NAME, "posting [%s]\n", reqs[i] );
if(( res = curl_easy_perform( curl )))
tr_nerr( MY_NAME, "(%s:%d) %s", host, port, curl_easy_strerror( res ) );
else