library/src/blockclass/BP-BlockClass.cc
// ======== Attach Proxies to Http Session (required before autoproxying can be done) =====
Attach Proxies to Http Session (required before autoproxying can be done)
Attach Proxies to Http Session ( required before autoproxying can be done )
BP_ERROR_T Block::attachProxyDBRecordsToHttpSession(P_BP_HTTP_SESSION session)
{
	if(!this->mysqlSession)
		return ERR_FAILURE;
	BP_BLOCK_MARIADB_ENTER_CRITICAL_SECTION;
	P_BP_HTTP_SESSION use_session = NULL;
	if(session)
		use_session = session;
	else
		use_session = this->httpSession;
	if(!use_session)
	{
		this->AddErrorToStack((char*) "Unable to attach proxy db records to http session.");
		BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(ERR_FAILURE);
	}
	use_session->use_db_proxy_set = true;
	use_session->db_populated_proxy_groups             = this->db_populated_proxy_groups;
	use_session->db_populated_proxy_group_n            = this->db_populated_proxy_group_n;
	use_session->db_populated_proxy_sets               = this->db_populated_proxy_sets;
	use_session->db_populated_proxy_n                  = this->db_populated_proxy_n;
	use_session->db_populated_proxy_validation_groups  = this->db_populated_proxy_validation_groups;
	use_session->db_populated_proxy_validation_group_n = this->db_populated_proxy_validation_group_n;
	use_session->db_populated_proxy_validation_tests   = this->db_populated_proxy_validation_tests;
	use_session->db_populated_proxy_validation_test_n  = this->db_populated_proxy_validation_test_n;
	BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(ERR_SUCCESS);
}
BP_ERROR_T Block :: attachProxyDBRecordsToHttpSession ( P_BP_HTTP_SESSION session ) { if ( ! this -> mysqlSession ) return ERR_FAILURE ; BP_BLOCK_MARIADB_ENTER_CRITICAL_SECTION ; P_BP_HTTP_SESSION use_session = NULL ; if ( session ) use_session = session ; else use_session = this -> httpSession ; if ( ! use_session ) { this -> AddErrorToStack ( ( char * ) " " ) ; BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( ERR_FAILURE ) ; } use_session -> use_db_proxy_set = true ; use_session -> db_populated_proxy_groups = this -> db_populated_proxy_groups ; use_session -> db_populated_proxy_group_n = this -> db_populated_proxy_group_n ; use_session -> db_populated_proxy_sets = this -> db_populated_proxy_sets ; use_session -> db_populated_proxy_n = this -> db_populated_proxy_n ; use_session -> db_populated_proxy_validation_groups = this -> db_populated_proxy_validation_groups ; use_session -> db_populated_proxy_validation_group_n = this -> db_populated_proxy_validation_group_n ; use_session -> db_populated_proxy_validation_tests = this -> db_populated_proxy_validation_tests ; use_session -> db_populated_proxy_validation_test_n = this -> db_populated_proxy_validation_test_n ; BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( ERR_SUCCESS ) ; }
Attach Proxies to Http Session (required before autoproxying can be done)
Attach Proxies to Http Session ( required before autoproxying can be done )
// exit if the mysqli object is unset // enter critical section // select either a provided session, or the current session in the class // ensure at least one session is set // // set indicator to true (will use proxies on request) // set proxy information in session // return indicating success