mirror of
https://github.com/transmission/transmission
synced 2025-02-03 13:03:50 +00:00
#934: remove invalid tracker addresses
This commit is contained in:
parent
958e70543e
commit
4398943230
1 changed files with 14 additions and 0 deletions
|
@ -954,6 +954,20 @@ tr_sha1_to_hex( char * out, const uint8_t * sha1 )
|
|||
int
|
||||
tr_httpIsValidURL( const char * url )
|
||||
{
|
||||
const char * c;
|
||||
static const char * rfc2396_valid_chars =
|
||||
"abcdefghijklmnopqrstuvwxyz" /* lowalpha */
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" /* upalpha */
|
||||
"0123456789" /* digit */
|
||||
"-_.!~*'()" /* mark */
|
||||
";/?:@&=+$," /* reserved */
|
||||
"<>#%<\"" /* delims */
|
||||
"{}|\\^[]`"; /* unwise */
|
||||
|
||||
for( c=url; c && *c; ++c )
|
||||
if( !strchr( rfc2396_valid_chars, *c ) )
|
||||
return FALSE;
|
||||
|
||||
return !tr_httpParseURL( url, -1, NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue