mirror of
https://github.com/transmission/transmission
synced 2025-02-20 13:16:53 +00:00
(trunk libT) #1784: add .netrc support to transmission-remote
This commit is contained in:
parent
9727985836
commit
ab765330ec
2 changed files with 18 additions and 5 deletions
|
@ -76,6 +76,7 @@ static tr_option opts[] =
|
|||
{ 'm', "portmap", "Enable portmapping via NAT-PMP or UPnP", "m", 0, NULL },
|
||||
{ 'M', "no-portmap", "Disable portmapping", "M", 0, NULL },
|
||||
{ 'n', "auth", "Set authentication info", "n", 1, "<username:password>" },
|
||||
{ 'N', "netrc", "Set authentication info from a .netrc file", "N", 1, "<filename>" },
|
||||
{ 'p', "port", "Port for incoming peers (Default: " TR_DEFAULT_PEER_PORT_STR ")", "p", 1, "<port>" },
|
||||
{ 900, "priority-high", "Set the files' priorities as high", "ph", 1, "<files>" },
|
||||
{ 901, "priority-normal", "Set the files' priorities as normal", "pn", 1, "<files>" },
|
||||
|
@ -123,6 +124,7 @@ static char * reqs[256]; /* arbitrary max */
|
|||
static int reqCount = 0;
|
||||
static int debug = 0;
|
||||
static char * auth = NULL;
|
||||
static char * netrc = NULL;
|
||||
|
||||
static char*
|
||||
tr_getcwd( void )
|
||||
|
@ -399,6 +401,11 @@ readargs( int argc,
|
|||
addArg = FALSE;
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
netrc = tr_strdup( optarg );
|
||||
addArg = FALSE;
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
tr_bencDictAddStr( &top, "method", "session-set" );
|
||||
tr_bencDictAddInt( args, "port", numarg( optarg ) );
|
||||
|
@ -1212,17 +1219,17 @@ processRequests( const char * host,
|
|||
#ifdef HAVE_LIBZ
|
||||
curl_easy_setopt( curl, CURLOPT_ENCODING, "deflate" );
|
||||
#endif
|
||||
curl_easy_setopt( curl, CURLOPT_USERAGENT,
|
||||
MY_NAME "/" LONG_VERSION_STRING );
|
||||
curl_easy_setopt( curl, CURLOPT_USERAGENT, MY_NAME "/" LONG_VERSION_STRING );
|
||||
curl_easy_setopt( curl, CURLOPT_WRITEFUNCTION, writeFunc );
|
||||
curl_easy_setopt( curl, CURLOPT_WRITEDATA, buf );
|
||||
curl_easy_setopt( curl, CURLOPT_POST, 1 );
|
||||
curl_easy_setopt( curl, CURLOPT_URL, url );
|
||||
curl_easy_setopt( curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL );
|
||||
curl_easy_setopt( curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY );
|
||||
if( netrc )
|
||||
curl_easy_setopt( curl, CURLOPT_NETRC_FILE, netrc );
|
||||
if( auth )
|
||||
{
|
||||
curl_easy_setopt( curl, CURLOPT_USERPWD, auth );
|
||||
curl_easy_setopt( curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY );
|
||||
}
|
||||
|
||||
for( i = 0; i < reqCount; ++i )
|
||||
{
|
||||
|
|
|
@ -24,6 +24,7 @@ and
|
|||
.Op Fl l
|
||||
.Op Fl m | M
|
||||
.Op Fl n Ar user:pass
|
||||
.Op Fl N Ar netrc
|
||||
.Op Fl p Ar port
|
||||
.Op Fl ph Ar files
|
||||
.Op Fl pl Ar files
|
||||
|
@ -116,6 +117,11 @@ and
|
|||
.Ar password
|
||||
for authentication
|
||||
|
||||
.It Fl N Fl -netrc Ar filename
|
||||
Set the authentication information from a
|
||||
.Ar netrc file.
|
||||
See netrc(5) for more information.
|
||||
|
||||
.It Fl p Fl -port Ar port
|
||||
Set the
|
||||
.Ar port
|
||||
|
|
Loading…
Reference in a new issue