Lines Matching refs:web
10 * $Id: web.c 13245 2012-03-04 13:21:42Z jordan $
33 #include "web.h"
54 tr_deepLog( __FILE__, __LINE__, "web", __VA_ARGS__ ); \
157 createEasy( tr_session * s, struct tr_web * web, struct tr_web_task * task )
166 curl_easy_setopt( e, CURLOPT_COOKIEFILE, web->cookie_filename );
176 if( web->curl_ssl_verify )
177 curl_easy_setopt( e, CURLOPT_CAINFO, web->curl_ca_bundle );
185 curl_easy_setopt( e, CURLOPT_VERBOSE, (long)(web->curl_verbose?1:0) );
214 dbgmsg( "finished web task %p; got %ld", task, task->code );
254 struct tr_web * web = session->web;
256 if( web != NULL )
269 tr_lockLock( web->taskLock );
270 task->next = web->tasks;
271 web->tasks = task;
272 tr_lockUnlock( web->taskLock );
315 struct tr_web * web;
325 web = tr_new0( struct tr_web, 1 );
326 web->close_mode = ~0;
327 web->taskLock = tr_lockNew( );
328 web->tasks = NULL;
329 web->curl_verbose = getenv( "TR_CURL_VERBOSE" ) != NULL;
330 web->curl_ssl_verify = getenv( "TR_CURL_SSL_VERIFY" ) != NULL;
331 web->curl_ca_bundle = getenv( "CURL_CA_BUNDLE" );
332 if( web->curl_ssl_verify ) {
333 tr_ninf( "web", "will verify tracker certs using envvar CURL_CA_BUNDLE: %s",
334 web->curl_ca_bundle == NULL ? "none" : web->curl_ca_bundle );
335 tr_ninf( "web", "NB: this only works if you built against libcurl with openssl or gnutls, NOT nss" );
336 tr_ninf( "web", "NB: invalid certs will show up as 'Could not connect to tracker' like many other errors" );
338 web->cookie_filename = tr_buildPath( session->configDir, "cookies.txt", NULL );
341 session->web = web;
350 if( web->close_mode == TR_WEB_CLOSE_NOW )
352 if( ( web->close_mode == TR_WEB_CLOSE_WHEN_IDLE ) && ( web->tasks == NULL ) )
356 tr_lockLock( web->taskLock );
357 while( web->tasks != NULL )
360 task = web->tasks;
361 web->tasks = task->next;
365 curl_multi_add_handle( multi, createEasy( session, web, task ));
369 tr_lockUnlock( web->taskLock );
431 while( web->tasks != NULL ) {
432 task = web->tasks;
433 web->tasks = task->next;
440 tr_lockFree( web->taskLock );
441 tr_free( web->cookie_filename );
442 tr_free( web );
443 session->web = NULL;
455 if( session->web != NULL )
457 session->web->close_mode = close_mode;
460 while( session->web != NULL )