我正在使用带有firebreath的CURL来下载图像,我的代码如下所示。
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &writeCallbacks);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&data);
curl_easy_setopt(curl, CURLOPT_URL, api_url);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
curl_easy_setopt(curl, CURLOPT_REFERER, "SERVICE");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, buffer);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);
response = curl_easy_perform(curl);
if(response != CURLE_OK)
{
_error = curl_easy_strerror(response);
}
如果我等到过程完成,它可以正常工作。如果我在下载过程中刷新页面,或者一旦调用curl_easy_perform(curl),就会导致访问冲突错误和插件崩溃。如何处理...
我试图在析构函数上调用curl_easy_cleanup(curl)并且它没有帮助。
请帮忙......