1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-15 10:54:42 +00:00

when creating a new torrent and a tracker announce URL can't be parsed, set a variable so that the client can learn which announce URL was the bad one

This commit is contained in:
Charles Kerr 2009-09-17 01:18:59 +00:00
parent fd934eeaff
commit 9b9c910d67
2 changed files with 10 additions and 3 deletions

View file

@ -379,9 +379,13 @@ tr_realMakeMetaInfo( tr_metainfo_builder * builder )
tr_benc top;
/* 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 ) )
for( i = 0; i < builder->trackerCount && !builder->result; ++i ) {
if( !tr_httpIsValidURL( builder->trackers[i].announce ) ) {
tr_strlcpy( builder->errfile, builder->trackers[i].announce,
sizeof( builder->errfile ) );
builder->result = TR_MAKEMETA_URL;
}
}
tr_bencInitDict( &top, 6 );
@ -506,7 +510,9 @@ tr_makeMetaInfo( tr_metainfo_builder * builder,
/* initialize the builder variables */
builder->abortFlag = 0;
builder->result = 0;
builder->isDone = 0;
builder->pieceIndex = 0;
builder->trackerCount = trackerCount;
builder->trackers = tr_new0( tr_tracker_info, builder->trackerCount );
for( i = 0; i < builder->trackerCount; ++i )

View file

@ -74,7 +74,8 @@ typedef struct tr_metainfo_builder
int isDone;
tr_metainfo_builder_err result;
/* file in use when result was set to _IO_READ or _IO_WRITE */
/* file in use when result was set to _IO_READ or _IO_WRITE,
* or the URL in use when the result was set to _URL */
char errfile[2048];
/* errno encountered when result was set to _IO_READ or _IO_WRITE */