#3535 remove unnecessary escape characters and use lowercase in escaped letters in info_hash

This commit is contained in:
Mitchell Livingston 2010-08-31 11:49:09 +00:00
parent 0235bd962a
commit 05fabc6255
1 changed files with 6 additions and 2 deletions

View File

@ -387,7 +387,11 @@ is_rfc2396_alnum( char ch )
{
return ( '0' <= ch && ch <= '9' )
|| ( 'A' <= ch && ch <= 'Z' )
|| ( 'a' <= ch && ch <= 'z' );
|| ( 'a' <= ch && ch <= 'z' )
|| ch == '.'
|| ch == '-'
|| ch == '_'
|| ch == '~';
}
static void
@ -399,7 +403,7 @@ escape( char * out, const uint8_t * in, size_t in_len ) /* rfc2396 */
if( is_rfc2396_alnum( *in ) )
*out++ = (char) *in++;
else
out += tr_snprintf( out, 4, "%%%02X", (unsigned int)*in++ );
out += tr_snprintf( out, 4, "%%%02x", (unsigned int)*in++ );
*out = '\0';
}