mirror of
https://github.com/transmission/transmission
synced 2025-02-22 14:10:34 +00:00
(trunk) #3688 "remove proxy support" -- remove from libtransmission
This commit is contained in:
parent
295f2b13b8
commit
22c622a92f
5 changed files with 0 additions and 283 deletions
28
gtk/main.c
28
gtk/main.c
|
@ -1286,34 +1286,6 @@ prefschanged( TrCore * core UNUSED, const char * key, gpointer data )
|
|||
{
|
||||
tr_sessionSetRPCPasswordEnabled( tr, pref_flag_get( key ) );
|
||||
}
|
||||
else if( !strcmp( key, TR_PREFS_KEY_PROXY ) )
|
||||
{
|
||||
tr_sessionSetProxy( tr, pref_string_get( key ) );
|
||||
}
|
||||
else if( !strcmp( key, TR_PREFS_KEY_PROXY_TYPE ) )
|
||||
{
|
||||
tr_sessionSetProxyType( tr, pref_int_get( key ) );
|
||||
}
|
||||
else if( !strcmp( key, TR_PREFS_KEY_PROXY_ENABLED ) )
|
||||
{
|
||||
tr_sessionSetProxyEnabled( tr, pref_flag_get( key ) );
|
||||
}
|
||||
else if( !strcmp( key, TR_PREFS_KEY_PROXY_AUTH_ENABLED ) )
|
||||
{
|
||||
tr_sessionSetProxyAuthEnabled( tr, pref_flag_get( key ) );
|
||||
}
|
||||
else if( !strcmp( key, TR_PREFS_KEY_PROXY_USERNAME ) )
|
||||
{
|
||||
tr_sessionSetProxyUsername( tr, pref_string_get( key ) );
|
||||
}
|
||||
else if( !strcmp( key, TR_PREFS_KEY_PROXY_PASSWORD ) )
|
||||
{
|
||||
tr_sessionSetProxyPassword( tr, pref_string_get( key ) );
|
||||
}
|
||||
else if( !strcmp( key, TR_PREFS_KEY_PROXY_PORT ) )
|
||||
{
|
||||
tr_sessionSetProxyPort( tr, pref_int_get( key ) );
|
||||
}
|
||||
else if( !strcmp( key, TR_PREFS_KEY_ALT_SPEED_UP_KBps ) )
|
||||
{
|
||||
tr_sessionSetAltSpeed_KBps( tr, TR_UP, pref_int_get( key ) );
|
||||
|
|
|
@ -272,13 +272,6 @@ tr_sessionGetDefaultSettings( const char * configDir UNUSED, tr_benc * d )
|
|||
tr_bencDictAddBool( d, TR_PREFS_KEY_PEX_ENABLED, TRUE );
|
||||
tr_bencDictAddBool( d, TR_PREFS_KEY_PORT_FORWARDING, TRUE );
|
||||
tr_bencDictAddInt ( d, TR_PREFS_KEY_PREALLOCATION, TR_PREALLOCATE_SPARSE );
|
||||
tr_bencDictAddStr ( d, TR_PREFS_KEY_PROXY, "" );
|
||||
tr_bencDictAddBool( d, TR_PREFS_KEY_PROXY_AUTH_ENABLED, FALSE );
|
||||
tr_bencDictAddBool( d, TR_PREFS_KEY_PROXY_ENABLED, FALSE );
|
||||
tr_bencDictAddStr ( d, TR_PREFS_KEY_PROXY_PASSWORD, "" );
|
||||
tr_bencDictAddInt ( d, TR_PREFS_KEY_PROXY_PORT, 80 );
|
||||
tr_bencDictAddInt ( d, TR_PREFS_KEY_PROXY_TYPE, TR_PROXY_HTTP );
|
||||
tr_bencDictAddStr ( d, TR_PREFS_KEY_PROXY_USERNAME, "" );
|
||||
tr_bencDictAddReal( d, TR_PREFS_KEY_RATIO, 2.0 );
|
||||
tr_bencDictAddBool( d, TR_PREFS_KEY_RATIO_ENABLED, FALSE );
|
||||
tr_bencDictAddBool( d, TR_PREFS_KEY_RENAME_PARTIAL_FILES, TRUE );
|
||||
|
@ -342,13 +335,6 @@ tr_sessionGetSettings( tr_session * s, struct tr_benc * d )
|
|||
tr_bencDictAddBool( d, TR_PREFS_KEY_PEX_ENABLED, s->isPexEnabled );
|
||||
tr_bencDictAddBool( d, TR_PREFS_KEY_PORT_FORWARDING, tr_sessionIsPortForwardingEnabled( s ) );
|
||||
tr_bencDictAddInt ( d, TR_PREFS_KEY_PREALLOCATION, s->preallocationMode );
|
||||
tr_bencDictAddStr ( d, TR_PREFS_KEY_PROXY, s->proxy );
|
||||
tr_bencDictAddBool( d, TR_PREFS_KEY_PROXY_AUTH_ENABLED, s->isProxyAuthEnabled );
|
||||
tr_bencDictAddBool( d, TR_PREFS_KEY_PROXY_ENABLED, s->isProxyEnabled );
|
||||
tr_bencDictAddStr ( d, TR_PREFS_KEY_PROXY_PASSWORD, s->proxyPassword );
|
||||
tr_bencDictAddInt ( d, TR_PREFS_KEY_PROXY_PORT, s->proxyPort );
|
||||
tr_bencDictAddInt ( d, TR_PREFS_KEY_PROXY_TYPE, s->proxyType );
|
||||
tr_bencDictAddStr ( d, TR_PREFS_KEY_PROXY_USERNAME, s->proxyUsername );
|
||||
tr_bencDictAddReal( d, TR_PREFS_KEY_RATIO, s->desiredRatio );
|
||||
tr_bencDictAddBool( d, TR_PREFS_KEY_RATIO_ENABLED, s->isRatioLimited );
|
||||
tr_bencDictAddBool( d, TR_PREFS_KEY_RENAME_PARTIAL_FILES, tr_sessionIsIncompleteFileNamingEnabled( s ) );
|
||||
|
@ -716,22 +702,6 @@ sessionSetImpl( void * vdata )
|
|||
if( tr_bencDictFindBool( settings, TR_PREFS_KEY_RENAME_PARTIAL_FILES, &boolVal ) )
|
||||
tr_sessionSetIncompleteFileNamingEnabled( session, boolVal );
|
||||
|
||||
/* proxies */
|
||||
if( tr_bencDictFindBool( settings, TR_PREFS_KEY_PROXY_ENABLED, &boolVal ) )
|
||||
tr_sessionSetProxyEnabled( session, boolVal );
|
||||
if( tr_bencDictFindStr( settings, TR_PREFS_KEY_PROXY, &str ) )
|
||||
tr_sessionSetProxy( session, str );
|
||||
if( tr_bencDictFindInt( settings, TR_PREFS_KEY_PROXY_PORT, &i ) )
|
||||
tr_sessionSetProxyPort( session, i );
|
||||
if( tr_bencDictFindInt( settings, TR_PREFS_KEY_PROXY_TYPE, &i ) )
|
||||
tr_sessionSetProxyType( session, i );
|
||||
if( tr_bencDictFindBool( settings, TR_PREFS_KEY_PROXY_AUTH_ENABLED, &boolVal ) )
|
||||
tr_sessionSetProxyAuthEnabled( session, boolVal );
|
||||
if( tr_bencDictFindStr( settings, TR_PREFS_KEY_PROXY_USERNAME, &str ) )
|
||||
tr_sessionSetProxyUsername( session, str );
|
||||
if( tr_bencDictFindStr( settings, TR_PREFS_KEY_PROXY_PASSWORD, &str ) )
|
||||
tr_sessionSetProxyPassword( session, str );
|
||||
|
||||
/* rpc server */
|
||||
if( session->rpcServer != NULL ) /* close the old one */
|
||||
tr_rpcClose( &session->rpcServer );
|
||||
|
@ -1785,9 +1755,6 @@ tr_sessionClose( tr_session * session )
|
|||
tr_free( session->torrentDir );
|
||||
tr_free( session->downloadDir );
|
||||
tr_free( session->incompleteDir );
|
||||
tr_free( session->proxy );
|
||||
tr_free( session->proxyUsername );
|
||||
tr_free( session->proxyPassword );
|
||||
tr_free( session->peer_congestion_algorithm );
|
||||
tr_free( session );
|
||||
}
|
||||
|
@ -2441,143 +2408,6 @@ tr_sessionGetRPCBindAddress( const tr_session * session )
|
|||
return tr_rpcGetBindAddress( session->rpcServer );
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
tr_bool
|
||||
tr_sessionIsProxyEnabled( const tr_session * session )
|
||||
{
|
||||
assert( tr_isSession( session ) );
|
||||
|
||||
return session->isProxyEnabled;
|
||||
}
|
||||
|
||||
void
|
||||
tr_sessionSetProxyEnabled( tr_session * session,
|
||||
tr_bool isEnabled )
|
||||
{
|
||||
assert( tr_isSession( session ) );
|
||||
assert( tr_isBool( isEnabled ) );
|
||||
|
||||
session->isProxyEnabled = isEnabled != 0;
|
||||
}
|
||||
|
||||
tr_proxy_type
|
||||
tr_sessionGetProxyType( const tr_session * session )
|
||||
{
|
||||
assert( tr_isSession( session ) );
|
||||
|
||||
return session->proxyType;
|
||||
}
|
||||
|
||||
void
|
||||
tr_sessionSetProxyType( tr_session * session,
|
||||
tr_proxy_type type )
|
||||
{
|
||||
assert( tr_isSession( session ) );
|
||||
|
||||
session->proxyType = type;
|
||||
}
|
||||
|
||||
const char*
|
||||
tr_sessionGetProxy( const tr_session * session )
|
||||
{
|
||||
assert( tr_isSession( session ) );
|
||||
|
||||
return session->proxy;
|
||||
}
|
||||
|
||||
tr_port
|
||||
tr_sessionGetProxyPort( const tr_session * session )
|
||||
{
|
||||
assert( tr_isSession( session ) );
|
||||
|
||||
return session->proxyPort;
|
||||
}
|
||||
|
||||
void
|
||||
tr_sessionSetProxy( tr_session * session,
|
||||
const char * proxy )
|
||||
{
|
||||
assert( tr_isSession( session ) );
|
||||
|
||||
if( proxy != session->proxy )
|
||||
{
|
||||
tr_free( session->proxy );
|
||||
session->proxy = tr_strdup( proxy );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tr_sessionSetProxyPort( tr_session * session,
|
||||
tr_port port )
|
||||
{
|
||||
assert( tr_isSession( session ) );
|
||||
|
||||
session->proxyPort = port;
|
||||
}
|
||||
|
||||
tr_bool
|
||||
tr_sessionIsProxyAuthEnabled( const tr_session * session )
|
||||
{
|
||||
assert( tr_isSession( session ) );
|
||||
|
||||
return session->isProxyAuthEnabled;
|
||||
}
|
||||
|
||||
void
|
||||
tr_sessionSetProxyAuthEnabled( tr_session * session,
|
||||
tr_bool isEnabled )
|
||||
{
|
||||
assert( tr_isSession( session ) );
|
||||
assert( tr_isBool( isEnabled ) );
|
||||
|
||||
session->isProxyAuthEnabled = isEnabled != 0;
|
||||
}
|
||||
|
||||
const char*
|
||||
tr_sessionGetProxyUsername( const tr_session * session )
|
||||
{
|
||||
assert( tr_isSession( session ) );
|
||||
|
||||
return session->proxyUsername;
|
||||
}
|
||||
|
||||
void
|
||||
tr_sessionSetProxyUsername( tr_session * session,
|
||||
const char * username )
|
||||
{
|
||||
assert( tr_isSession( session ) );
|
||||
|
||||
if( username != session->proxyUsername )
|
||||
{
|
||||
tr_free( session->proxyUsername );
|
||||
session->proxyUsername = tr_strdup( username );
|
||||
}
|
||||
}
|
||||
|
||||
const char*
|
||||
tr_sessionGetProxyPassword( const tr_session * session )
|
||||
{
|
||||
assert( tr_isSession( session ) );
|
||||
|
||||
return session->proxyPassword;
|
||||
}
|
||||
|
||||
void
|
||||
tr_sessionSetProxyPassword( tr_session * session,
|
||||
const char * password )
|
||||
{
|
||||
assert( tr_isSession( session ) );
|
||||
|
||||
if( password != session->proxyPassword )
|
||||
{
|
||||
tr_free( session->proxyPassword );
|
||||
session->proxyPassword = tr_strdup( password );
|
||||
}
|
||||
}
|
||||
|
||||
/****
|
||||
*****
|
||||
****/
|
||||
|
|
|
@ -88,8 +88,6 @@ struct tr_session
|
|||
tr_bool isDHTEnabled;
|
||||
tr_bool isLPDEnabled;
|
||||
tr_bool isBlocklistEnabled;
|
||||
tr_bool isProxyEnabled;
|
||||
tr_bool isProxyAuthEnabled;
|
||||
tr_bool isTorrentDoneScriptEnabled;
|
||||
tr_bool isClosed;
|
||||
tr_bool useLazyBitfield;
|
||||
|
@ -137,7 +135,6 @@ struct tr_session
|
|||
tr_port randomPortLow;
|
||||
tr_port randomPortHigh;
|
||||
|
||||
int proxyPort;
|
||||
int peerSocketTOS;
|
||||
char * peer_congestion_algorithm;
|
||||
|
||||
|
@ -153,11 +150,6 @@ struct tr_session
|
|||
char * torrentDir;
|
||||
char * incompleteDir;
|
||||
|
||||
tr_proxy_type proxyType;
|
||||
char * proxy;
|
||||
char * proxyUsername;
|
||||
char * proxyPassword;
|
||||
|
||||
struct tr_list * blocklists;
|
||||
struct tr_peerMgr * peerMgr;
|
||||
struct tr_shared * shared;
|
||||
|
|
|
@ -88,14 +88,6 @@ typedef enum
|
|||
}
|
||||
tr_preallocation_mode;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TR_PROXY_HTTP,
|
||||
TR_PROXY_SOCKS4,
|
||||
TR_PROXY_SOCKS5
|
||||
}
|
||||
tr_proxy_type;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TR_CLEAR_PREFERRED,
|
||||
|
@ -187,14 +179,7 @@ const char* tr_getDefaultDownloadDir( void );
|
|||
#define TR_PREFS_KEY_PEER_CONGESTION_ALGORITHM "peer-congestion-algorithm"
|
||||
#define TR_PREFS_KEY_PEX_ENABLED "pex-enabled"
|
||||
#define TR_PREFS_KEY_PORT_FORWARDING "port-forwarding-enabled"
|
||||
#define TR_PREFS_KEY_PROXY_AUTH_ENABLED "proxy-auth-enabled"
|
||||
#define TR_PREFS_KEY_PREALLOCATION "preallocation"
|
||||
#define TR_PREFS_KEY_PROXY_ENABLED "proxy-enabled"
|
||||
#define TR_PREFS_KEY_PROXY_PASSWORD "proxy-auth-password"
|
||||
#define TR_PREFS_KEY_PROXY_PORT "proxy-port"
|
||||
#define TR_PREFS_KEY_PROXY "proxy"
|
||||
#define TR_PREFS_KEY_PROXY_TYPE "proxy-type"
|
||||
#define TR_PREFS_KEY_PROXY_USERNAME "proxy-auth-username"
|
||||
#define TR_PREFS_KEY_RATIO "ratio-limit"
|
||||
#define TR_PREFS_KEY_RATIO_ENABLED "ratio-limit-enabled"
|
||||
#define TR_PREFS_KEY_RENAME_PARTIAL_FILES "rename-partial-files"
|
||||
|
@ -526,45 +511,6 @@ void tr_sessionSetRPCCallback( tr_session * session,
|
|||
***
|
||||
**/
|
||||
|
||||
tr_bool tr_sessionIsProxyEnabled( const tr_session * );
|
||||
|
||||
tr_bool tr_sessionIsProxyAuthEnabled( const tr_session * );
|
||||
|
||||
const char* tr_sessionGetProxy( const tr_session * );
|
||||
|
||||
tr_port tr_sessionGetProxyPort( const tr_session * );
|
||||
|
||||
tr_proxy_type tr_sessionGetProxyType( const tr_session * );
|
||||
|
||||
const char* tr_sessionGetProxyUsername( const tr_session * );
|
||||
|
||||
const char* tr_sessionGetProxyPassword( const tr_session * );
|
||||
|
||||
void tr_sessionSetProxyEnabled( tr_session * session,
|
||||
tr_bool isEnabled );
|
||||
|
||||
void tr_sessionSetProxyAuthEnabled( tr_session * session,
|
||||
tr_bool isEnabled );
|
||||
|
||||
void tr_sessionSetProxy( tr_session * session,
|
||||
const char * proxy );
|
||||
|
||||
void tr_sessionSetProxyPort( tr_session * session,
|
||||
tr_port port );
|
||||
|
||||
void tr_sessionSetProxyType( tr_session * session,
|
||||
tr_proxy_type proxy_type );
|
||||
|
||||
void tr_sessionSetProxyUsername( tr_session * session,
|
||||
const char * username );
|
||||
|
||||
void tr_sessionSetProxyPassword( tr_session * session,
|
||||
const char * password );
|
||||
|
||||
/**
|
||||
***
|
||||
**/
|
||||
|
||||
/** @brief Used by tr_sessionGetStats() and tr_sessionGetCumulativeStats() to give bandwidth statistics */
|
||||
typedef struct tr_session_stats
|
||||
{
|
||||
|
|
|
@ -124,14 +124,6 @@ sockoptfunction( void * vtask, curl_socket_t fd, curlsocktype purpose UNUSED )
|
|||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
getCurlProxyType( tr_proxy_type t )
|
||||
{
|
||||
if( t == TR_PROXY_SOCKS4 ) return CURLPROXY_SOCKS4;
|
||||
if( t == TR_PROXY_SOCKS5 ) return CURLPROXY_SOCKS5;
|
||||
return CURLPROXY_HTTP;
|
||||
}
|
||||
|
||||
static long
|
||||
getTimeoutFromURL( const struct tr_web_task * task )
|
||||
{
|
||||
|
@ -154,21 +146,6 @@ createEasy( tr_session * s, struct tr_web_task * task )
|
|||
const long verbose = getenv( "TR_CURL_VERBOSE" ) != NULL;
|
||||
char * cookie_filename = tr_buildPath( s->configDir, "cookies.txt", NULL );
|
||||
|
||||
if( !task->range && s->isProxyEnabled ) {
|
||||
const long proxyType = getCurlProxyType( s->proxyType );
|
||||
curl_easy_setopt( e, CURLOPT_PROXY, s->proxy );
|
||||
curl_easy_setopt( e, CURLOPT_PROXYAUTH, CURLAUTH_ANY );
|
||||
curl_easy_setopt( e, CURLOPT_PROXYPORT, s->proxyPort );
|
||||
curl_easy_setopt( e, CURLOPT_PROXYTYPE, proxyType );
|
||||
}
|
||||
|
||||
if( !task->range && s->isProxyAuthEnabled ) {
|
||||
char * str = tr_strdup_printf( "%s:%s", s->proxyUsername,
|
||||
s->proxyPassword );
|
||||
curl_easy_setopt( e, CURLOPT_PROXYUSERPWD, str );
|
||||
tr_free( str );
|
||||
}
|
||||
|
||||
curl_easy_setopt( e, CURLOPT_AUTOREFERER, 1L );
|
||||
curl_easy_setopt( e, CURLOPT_COOKIEFILE, cookie_filename );
|
||||
curl_easy_setopt( e, CURLOPT_ENCODING, "gzip;q=1.0, deflate, identity" );
|
||||
|
|
Loading…
Reference in a new issue