From 5a9a07b71e40e40492ccb49bd259a119ab227e08 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sat, 20 Feb 2010 15:57:05 +0000 Subject: [PATCH] (trunk) #2938 "crash when adding a torrent by URL from an ftp source over RPC" -- fixed in trunk for 1.91 --- libtransmission/announcer.c | 2 +- libtransmission/makemeta.c | 2 +- libtransmission/metainfo.c | 4 +-- libtransmission/torrent.c | 2 +- libtransmission/utils-test.c | 9 ++++-- libtransmission/utils.c | 59 +++++++++++++++++++++++++++++------- libtransmission/utils.h | 21 +++++++------ libtransmission/web.c | 4 +-- 8 files changed, 74 insertions(+), 29 deletions(-) diff --git a/libtransmission/announcer.c b/libtransmission/announcer.c index 763ddcb31..f51d60425 100644 --- a/libtransmission/announcer.c +++ b/libtransmission/announcer.c @@ -133,7 +133,7 @@ getHostName( const char * url ) int port = 0; char * host = NULL; char * ret; - tr_httpParseURL( url, strlen( url ), &host, &port, NULL ); + tr_urlParse( url, strlen( url ), NULL, &host, &port, NULL ); ret = tr_strdup_printf( "%s:%d", ( host ? host : "invalid" ), port ); tr_free( host ); return ret; diff --git a/libtransmission/makemeta.c b/libtransmission/makemeta.c index a7b188efe..603fb971c 100644 --- a/libtransmission/makemeta.c +++ b/libtransmission/makemeta.c @@ -380,7 +380,7 @@ tr_realMakeMetaInfo( tr_metainfo_builder * builder ) /* allow an empty set, but if URLs *are* listed, verify them. #814, #971 */ for( i = 0; i < builder->trackerCount && !builder->result; ++i ) { - if( !tr_httpIsValidURL( builder->trackers[i].announce ) ) { + if( !tr_urlIsValidTracker( builder->trackers[i].announce ) ) { tr_strlcpy( builder->errfile, builder->trackers[i].announce, sizeof( builder->errfile ) ); builder->result = TR_MAKEMETA_URL; diff --git a/libtransmission/metainfo.c b/libtransmission/metainfo.c index c3cac5d1c..3dc9aea78 100644 --- a/libtransmission/metainfo.c +++ b/libtransmission/metainfo.c @@ -288,7 +288,7 @@ getannounce( tr_info * inf, tr_benc * meta ) if( tr_bencGetStr( tr_bencListChild( tier, j ), &str ) ) { char * url = tr_strstrip( tr_strdup( str ) ); - if( tr_httpIsValidURL( url ) ) + if( tr_urlIsValidTracker( url ) ) { tr_tracker_info * t = trackers + trackerCount; t->tier = validTiers; @@ -320,7 +320,7 @@ getannounce( tr_info * inf, tr_benc * meta ) && tr_bencDictFindStr( meta, "announce", &str ) ) { char * url = tr_strstrip( tr_strdup( str ) ); - if( tr_httpIsValidURL( url ) ) + if( tr_urlIsValidTracker( url ) ) { trackers = tr_new0( tr_tracker_info, 1 ); trackers[trackerCount].tier = 0; diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index ed2dc4711..856df7adb 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -2086,7 +2086,7 @@ tr_torrentSetAnnounceList( tr_torrent * tor, /* look for bad URLs */ for( i=0; ok && isession->web != NULL ) + if( ( task->session->web != NULL ) && ( host != NULL ) ) { struct dns_cache_item * item; tr_ptrArray * cache = &task->session->web->dns_cache; @@ -463,7 +463,7 @@ doDNS( void * vtask ) assert( task->resolved_host == NULL ); - if( !tr_httpParseURL( task->url, -1, &host, &port, NULL ) ) + if( !tr_urlParse( task->url, -1, NULL, &host, &port, NULL ) ) { task->port = port; task->host = host; -- 2.40.0