Ejemplo n.º 1
0
void wswcurl_start(wswcurl_req *req)
{
	CURLcode res;

	if (!req)
		return;
	if (req->status)
		return; // was already started

	if (!req->curl)
	{
		wswcurl_delete(req);
		return;
	}

	if (req->txhead)
	{
		CURLSETOPT(req->curl, res, CURLOPT_HTTPHEADER, req->txhead);
	}
	if (req->post)
	{
		CURLSETOPT(req->curl, res, CURLOPT_HTTPPOST, req->post);
		req->post_last = NULL;
	}
	// Initialize multi handle if needed
	if (curlmulti == NULL)
	{
		curlmulti = curl_multi_init();
		if (curlmulti == NULL) {
			CURLDBG(("OOPS: CURL MULTI NULL!!!"));
		}
	}

	req->status = WSTATUS_QUEUED; // queued
}
Ejemplo n.º 2
0
void wswcurl_start(wswcurl_req *req)
{
	CURLcode res;

	if (!req)
		return;
	if (req->status)
		return; // was already started

	if (!req->curl)
	{
		wswcurl_delete(req);
		return;
	}

	if (req->txhead)
	{
		CURLSETOPT(req->curl, res, CURLOPT_HTTPHEADER, req->txhead);
	}
	if (req->post)
	{
		CURLSETOPT(req->curl, res, CURLOPT_HTTPPOST, req->post);
		req->post_last = NULL;
	}

	req->status = WSTATUS_QUEUED; // queued
}
Ejemplo n.º 3
0
void wswcurl_cleanup( void )
{
	while( http_requests ) {
		wswcurl_delete( http_requests );
	}

	if( curldummy ) {
		curl_easy_cleanup( curldummy );
		curldummy = NULL;
	}

	Mem_FreePool( &wswcurl_mempool );
}
Ejemplo n.º 4
0
void wswcurl_cleanup( void )
{
	if( !wswcurl_mempool )
		return;

	while( http_requests ) {
		wswcurl_delete( http_requests );
	}

	if( curldummy ) {
		qcurl_easy_cleanup( curldummy );
		curldummy = NULL;
	}

	if( curlmulti ) {
		qcurl_multi_cleanup( curlmulti );
		curlmulti = NULL;
	}

	QMutex_Destroy( &curldummy_mutex );

	QMutex_Destroy( &http_requests_mutex );

#ifdef USE_OPENSSL
	if( cryptoLibrary )
	{
		qCRYPTO_set_locking_callback( NULL );
		if( crypto_num_mutexes && crypto_mutexes )
		{
			int mutex_num;
			for( mutex_num = 0; mutex_num < crypto_num_mutexes; mutex_num++ )
				QMutex_Destroy( &crypto_mutexes[mutex_num] );
			WFREE( crypto_mutexes );
			crypto_mutexes = NULL;
		}
		crypto_num_mutexes = 0;
	}
#endif

	if( curlLibrary ) {
		qcurl_global_cleanup();
	}

	wswcurl_unloadlib();

	Mem_FreePool( &wswcurl_mempool );
}
Ejemplo n.º 5
0
void wswcurl_cleanup( void )
{
	while( http_requests ) {
		wswcurl_delete( http_requests );
	}

	if( curldummy ) {
		curl_easy_cleanup( curldummy );
		curldummy = NULL;
	}

	curl_multi_cleanup( curlmulti );
	curlmulti = NULL;

	QMutex_Destroy( &http_requests_mutex );

	Mem_FreePool( &wswcurl_mempool );
}
Ejemplo n.º 6
0
void StatQuery_DestroyQuery( stat_query_t *query )
{
	// close wswcurl and json_in json_out
	if( query->req )
		wswcurl_delete( query->req );

	// cached responses
	if( query->response_tokens )
	{
		if( query->response_tokens[0] && query->response_tokens[0] != query->response_raw )
			SQFREE( query->response_tokens[0] );
		SQFREE( query->response_tokens );
	}

	if( query->response_raw )
		SQFREE( query->response_raw );

	// actual query
	SQFREE( query );
}
Ejemplo n.º 7
0
void wswcurl_cleanup()
{
    while (http_requests) {
        wswcurl_delete(http_requests);
    }
}