/*****************************************************************
 *          同 步 GET          *
 *****************************************************************/
HTTP_RESULTCODE	CHttp::SyncDownload(const std::string &strUrl, std::string & strResult)
{
	if (strUrl.empty())
	{
		return HTTPRESULT_FAIL;
	}

	if( m_bRunning )
	{
		return HTTPRESULT_FAIL;
	}

	m_bRunning	= true;
	Reset();	
	m_strUrl = strUrl;

	CURLcode eErrorCode = DoHttpGet();
	bool  bResult = GetResultData(strResult);
	m_bRunning	= false;

	if (bResult && CURLE_OK == eErrorCode)
	{
		return HTTPRESULT_OK;
	}	

	return GetErrorCode(eErrorCode);
}
HTTP_RESULTCODE HTTPRequest::startSynchronous()
{
	HTTP_RESULTCODE rCode = HTTPRESULT_FAIL;
	if (url.empty())
	{
		return rCode;
	}

	if( isRunning )
	{
		return rCode;
	}

	isRunning	= true;
	CURLcode code;
	switch (requestMethod)
	{
	case HttpMethod_GET:
		code = DoHttpGet();
		break;
	case HttpMethod_POST:
		code = DoHttpPost();
		break;
	case HttpMethod_HEAD:
		code = DoHttpHead();
		break;
	case HttpMethod_PUT:
		code = DoHttpPut();
		break;
	case HttpMethod_DELETE:
		code = DoHttpDelete();
		break;
	default:
		break;
	}
	isRunning = false;
	rCode = GetErrorCode(code);
	
	printf("%s",_pchResultData);
	/*
	//分发消息
	if (delegate != NULL)
	{
		if (rCode == HTTPRESULT_OK)
		{

			delegate->OnHttpComplete(this);
		}
		else
		{
			delegate->OnHttpFailed(this,rCode);
		}
		
	}
	*/
	return rCode;
}