社区大婶,遇到一个问题,用curl做请求的时候,有时候能得到response,有时候拿不到,就是在这行代码出错:
curl_easy_setopt(_curl_instance, CURLOPT_URL, api_url.c_str());
curl_easy_setopt(_curl_instance, CURLOPT_WRITEDATA, httpData.get());
curl_easy_setopt(_curl_instance, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_easy_setopt(_curl_instance, CURLOPT_TIMEOUT, 10);
LOG(INFO) << "checking....";
// Here may segmentation fault
res = curl_easy_perform(_curl_instance);
curl_easy_getinfo(_curl_instance, CURLINFO_RESPONSE_CODE, &httpCode);
LOG(INFO) << "done.";
有大佬指点一下吗?