mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +00:00
(trunk libT) resolve "noslashes" vs "keep_slashes" variable name inconsistency between the declaration and the definition of tr_http_escape()
This commit is contained in:
parent
c841adaf56
commit
63027e1d5a
4 changed files with 12 additions and 6 deletions
|
@ -703,7 +703,7 @@ createAnnounceURL( const tr_announcer * announcer,
|
|||
char ipv6_readable[INET6_ADDRSTRLEN];
|
||||
inet_ntop( AF_INET6, ipv6, ipv6_readable, INET6_ADDRSTRLEN );
|
||||
evbuffer_add_printf( buf, "&ipv6=");
|
||||
tr_http_escape( buf, ipv6_readable, strlen(ipv6_readable), 0 );
|
||||
tr_http_escape( buf, ipv6_readable, strlen(ipv6_readable), TRUE );
|
||||
}
|
||||
|
||||
ret = tr_strndup( EVBUFFER_DATA( buf ), EVBUFFER_LENGTH( buf ) );
|
||||
|
|
|
@ -649,12 +649,18 @@ tr_webGetResponseStr( long code )
|
|||
}
|
||||
|
||||
/* escapes a string to be URI-legal as per RFC 2396.
|
||||
like curl_escape() but can optionally avoid munging slashes. */
|
||||
like curl_escape() but can optionally avoid escaping slashes. */
|
||||
void
|
||||
tr_http_escape( struct evbuffer *out, const char *str, int len, int keep_slashes )
|
||||
tr_http_escape( struct evbuffer * out,
|
||||
const char * str,
|
||||
int len,
|
||||
tr_bool escape_slashes )
|
||||
{
|
||||
int i;
|
||||
|
||||
if( ( len < 0 ) && ( str != NULL ) )
|
||||
len = strlen( str );
|
||||
|
||||
for( i = 0; i < len; i++ ) {
|
||||
switch( str[i] ) {
|
||||
case ',': case '-': case '.':
|
||||
|
@ -673,7 +679,7 @@ tr_http_escape( struct evbuffer *out, const char *str, int len, int keep_slashes
|
|||
evbuffer_add( out, &str[i], 1 );
|
||||
break;
|
||||
case '/':
|
||||
if(keep_slashes) {
|
||||
if(!escape_slashes) {
|
||||
evbuffer_add( out, &str[i], 1 );
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ void tr_webRun( tr_session * session,
|
|||
|
||||
struct evbuffer;
|
||||
|
||||
void tr_http_escape( struct evbuffer *out, const char *str, int len, int noslashes );
|
||||
void tr_http_escape( struct evbuffer *out, const char *str, int len, tr_bool escape_slashes );
|
||||
|
||||
char* tr_http_unescape( const char * str, int len );
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ makeURL( tr_webseed * w,
|
|||
|
||||
/* if url ends with a '/', add the torrent name */
|
||||
if( url[url_len - 1] == '/' && file->name )
|
||||
tr_http_escape( out, file->name, strlen(file->name), 1 );
|
||||
tr_http_escape( out, file->name, strlen(file->name), FALSE );
|
||||
|
||||
ret = tr_strndup( EVBUFFER_DATA( out ), EVBUFFER_LENGTH( out ) );
|
||||
evbuffer_free( out );
|
||||
|
|
Loading…
Reference in a new issue