예제 #1
0
	int push_remote_data(char* url, char* data, size_t data_size,char* contentType)
	{
		int retval = SYNC_PUSH_CHANGES_ERROR;
		char* szData = 0;
		char* cookie = 0;

		CHttpClient* gHttpClient = NULL;

		cookie = get_db_session(load_source_url());

		if (!cookie && !strstr(url, "clientcreate"))
			return SYNC_PUSH_CHANGES_ERROR;
		
		gHttpClient = CHttpClient::NewL();
		
		gHttpClient->SetCookie(cookie);
		
		gHttpClient->InvokeHttpMethodL(CHttpConstants::EPost,
				(const TUint8*) url, 
				strlen(url), 
				(const TUint8*) data,
				data_size, contentType);

		szData = gHttpClient->GetResponse();

		retval = szData ? SYNC_PUSH_CHANGES_OK : SYNC_PUSH_CHANGES_ERROR;

		if (szData)
			free(szData);

		delete gHttpClient;
		
		return retval;
	}
예제 #2
0
	char* fetch_remote_data(char* url)
		{
		char* cookie = 0;
		char* retval = 0;
		CHttpClient* gHttpClient = NULL;

		cookie = get_db_session(load_source_url());

		if (!cookie && !strstr(url, "clientcreate"))
			{
			return NULL;
			}

		gHttpClient = CHttpClient::NewL();

		gHttpClient->SetCookie(cookie);

		if (cookie)
			free(cookie);

		gHttpClient->InvokeHttpMethodL(CHttpConstants::EGet, (const TUint8*) url, strlen(url), NULL, 0, NULL);

		retval = gHttpClient->GetResponse();

		delete gHttpClient;
		
		return retval;
	}