library/src/blockclass/BP-BlockClass.cc
// Validates the proxy list, populating the validated proxy arrays.  Will attempt
// to validate proxies according to type.
Validates the proxy list, populating the validated proxy arrays.  Will attempt
to validate proxies according to type.
Validates the proxy list populating the validated proxy arrays . Will attempt to validate proxies according to type .
size_t Block::ValidateProxies(bool vhttp, bool vconnect, size_t proxy_type)
{
	if (!this->httpSession)
	{
		this->AddErrorToStack((char*) "Error in Block::ValidateProxies(): This function requires a valid httpSession.");
		return ERR_FAILURE;
	}
	if (!this->proxies)
	{
		this->AddErrorToStack((char*) "Error in Block::ValidateProxies(): No proxies are set");
		return ERR_FAILURE;
	}
	size_t i = 0;
	size_t x = 0;
	if (vhttp)
	{
		if (this->validatedHttpProxies)
		{
			tq_free(this->tq, this->validatedHttpProxies);
			this->validatedHttpProxies = NULL;
		}
		for (i = 0, x = 0; this->proxies[i]; i++)
		{
			if
			(
					this->ValidateHttpProxy(this->proxies[i], CURLPROXY_HTTP)   == ERR_SUCCESS ||
					this->ValidateHttpProxy(this->proxies[i], CURLPROXY_SOCKS4)	== ERR_SUCCESS ||
					this->ValidateHttpProxy(this->proxies[i], CURLPROXY_SOCKS5) == ERR_SUCCESS
			)
			{
				this->validatedHttpProxies = (char **) tq_realloc(this->tq, this->validatedHttpProxies, sizeof(char *) * (x + 2), BPLN);
				this->validatedHttpProxies[x] = this->proxies[i];
				x++;
			}
		}
		if (this->validatedHttpProxies)
			this->validatedHttpProxies[x] = NULL;
	}
	if (vconnect)
	{
	}
	return ERR_SUCCESS;
}
size_t Block :: ValidateProxies ( bool vhttp , bool vconnect , size_t proxy_type ) { if ( ! this -> httpSession ) { this -> AddErrorToStack ( ( char * ) " " ) ; return ERR_FAILURE ; } if ( ! this -> proxies ) { this -> AddErrorToStack ( ( char * ) " " ) ; return ERR_FAILURE ; } size_t i = 0 ; size_t x = 0 ; if ( vhttp ) { if ( this -> validatedHttpProxies ) { tq_free ( this -> tq , this -> validatedHttpProxies ) ; this -> validatedHttpProxies = NULL ; } for ( i = 0 , x = 0 ; this -> proxies [ i ] ; i ++ ) { if ( this -> ValidateHttpProxy ( this -> proxies [ i ] , CURLPROXY_HTTP ) == ERR_SUCCESS || this -> ValidateHttpProxy ( this -> proxies [ i ] , CURLPROXY_SOCKS4 ) == ERR_SUCCESS || this -> ValidateHttpProxy ( this -> proxies [ i ] , CURLPROXY_SOCKS5 ) == ERR_SUCCESS ) { this -> validatedHttpProxies = ( char * * ) tq_realloc ( this -> tq , this -> validatedHttpProxies , sizeof ( char * ) * ( x + 2 ) , BPLN ) ; this -> validatedHttpProxies [ x ] = this -> proxies [ i ] ; x ++ ; } } if ( this -> validatedHttpProxies ) this -> validatedHttpProxies [ x ] = NULL ; } if ( vconnect ) { } return ERR_SUCCESS ; }
Validates the proxy list, populating the validated proxy arrays.
Validates the proxy list populating the validated proxy arrays .
// index variables used for looping through ptr arrays // validate http proxies first if set // destroy old http proxy list if specified // now validate proxies one by one // if proxy is validated, add it to list // bprealloc validated proxies array with space for additional member // set pointer in structure // increment array index // null terminate array if set // validate connect proxies now // return indicating success