mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 12:28:52 +00:00
(#814) require a valid announce URL when creating torrents
This commit is contained in:
@@ -43,6 +43,8 @@
|
||||
#include <kernel/OS.h>
|
||||
#endif
|
||||
|
||||
#include <miniupnp/miniwget.h> /* parseURL */
|
||||
|
||||
#include "transmission.h"
|
||||
#include "trcompat.h"
|
||||
#include "utils.h"
|
||||
@@ -973,3 +975,33 @@ tr_sha1_to_hex( char * out, const uint8_t * sha1 )
|
||||
}
|
||||
*out = '\0';
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
int
|
||||
tr_httpParseUrl( const char * url_in, int len,
|
||||
char ** setme_host,
|
||||
int * setme_port,
|
||||
char ** setme_path )
|
||||
{
|
||||
char * url = tr_strndup( url_in, len );
|
||||
char * path;
|
||||
char host[4096+1];
|
||||
unsigned short port;
|
||||
int success;
|
||||
|
||||
success = parseURL( url, host, &port, &path );
|
||||
|
||||
if( success ) {
|
||||
if( setme_host ) *setme_host = tr_strdup( host );
|
||||
if( setme_port ) *setme_port = port;
|
||||
if( setme_path ) *setme_path = tr_strdup( path );
|
||||
}
|
||||
|
||||
tr_free( url );
|
||||
|
||||
return !success;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user