我正在尝试使用libcurl 7.20.0和openssl 0.9.8l下载文件(但我将库更新为7.29.0和1.0.1e),Windows 7并且所有内容都在编译amd64以下载大文件。我使用curlpp作为curl的包装器。问题是,一旦达到2GB,下载就会停止并显示错误Failed writing body (0 != 8999)
。我用来执行请求的代码是:
boost::shared_ptr<curlpp::Easy> curl_request(boost::make_shared<curlpp::Easy>());
curl_request.setOpt(new curlpp::options::HttpVersion(CURL_HTTP_VERSION_1_0));
curl_request.setOpt(new curlpp::options::Timeout(3600));
curl_request.setOpt(new curlpp::options::SslVerifyHost(0));
curl_request.setOpt(new curlpp::options::SslVerifyPeer(0));
curl_request->setOpt(new curlpp::options::Url(request_uri));
if (cookies.size() == 0) {
curl_request->setOpt(new curlpp::options::CookieList("dummy"));
} else {
BOOST_FOREACH(const std::string &cookie, m_cookies) {
curl_request->setOpt(new curlpp::options::CookieList(cookie));
}
}
curl_request->setOpt(new curlpp::options::Post(true));
curl_request->setOpt(new curlpp::options::PostFields(query_string));
curl_request->setOpt(new curlpp::options::WriteStream(stream.get()));
try {
curl_request->perform();
} catch (std::exception &ex) {
error = true;
std::cerr << "caught Unknown error: " << ex.what() << std::endl;
}
编辑该流是一个字符串流,我正在使用MS VS 2008
答案 0 :(得分:1)
这不是libcurl或OpenSSL限制。这可能是你的文件系统(FAT?)或WriteStream实现(或类似的)阻止它工作。
错误消息似乎意味着突然写入磁盘失败,这可能是当写入溢出支持的最大大小时。