curl调用流程

获取文件大小

static double iGetDownloadFileLenth(const char *pcUrl){
    double dRemoteFileLenth = 0;
	CURLcode result;
    CURL* pHnd = curl_easy_init();
    if(!pHnd) {
		ALOGE("http_upgrade curl_easy_init\n");
        return -1;
    }
	result = curl_global_init(CURL_GLOBAL_SSL);
	if(result) {
      /* something in the global init failed, return nothing */
      ALOGE("Error: iGetHttpConfigFileAndMD5 curl_global_init failed\n");
    }
		   
    curl_easy_setopt(pHnd, CURLOPT_URL, pcUrl);
    curl_easy_setopt(pHnd, CURLOPT_BUFFERSIZE, 16*1024);
	
	/*ignore peer SSL verifying.*/
	curl_easy_setopt(pHnd, CURLOPT_SSL_VERIFYPEER, 0L);
	/*igbore verification of the host name in the peer certificate.*/
	curl_easy_setopt(pHnd, CURLOPT_SSL_VERIFYHOST, 0L);
		
    curl_easy_setopt(pHnd, CURLOPT_HEADER, 1);
    curl_easy_setopt(pHnd, CURLOPT_NOBODY, 1);
    curl_easy_setopt(pHnd, CURLOPT_TIMEOUT, 60);    
    curl_easy_setopt(pHnd, CURLOPT_CONNECTTIMEOUT,
上一篇:15个优秀的 Material Design(材料设计)案例


下一篇:PKI系列:(5)证书下的Easy ***【远程访问 硬件与软件拨号】