Cocos2d-JS win32 获取远程图片失败
在win32 application 中使用libcurl.lib获取远程图片的大小返回CURLE_WRITE_ERROR
1、bug出现场景
当我在win32平台运行Cocos2d-JS的textureCacheTest的时候,发现第一个测试例,加载远程图片,一直获取失败,深入断点以后发现是使用libcurl获取图片信息时返回了错误码 23, CURLE_WRITE_ERROR 官方的解释是
An error occurred when writing received data to a local file, or an
error was returned to libcurl from a write callback.
(着急看解决方案的同学请看最后。)
问题代码如下:
void *curlHandle = curl_easy_init();
CC_ASSERT(headerInfo && "headerInfo must not be null");
curl_easy_setopt(curlHandle, CURLOPT_URL, url.c_str());
curl_easy_setopt(curlHandle, CURLOPT_HEADER, 1);
curl_easy_setopt(curlHandle, CURLOPT_NOBODY, 1);
curl_easy_setopt(curlHandle, CURLOPT_NOSIGNAL, 1);
if ((_lastErrCode=curl_easy_perform(