我正在Visual Studio 2017上与libcurl一起使用,以从Google网址获取请求,但程序崩溃而未调用被捕获的异常。我已经与其他2个网址进行了测试,效果很好。谷歌网址是: “ https://maps.googleapis.com/maps/api/elevation/json?locations=-23.64737184441803,-46.624&key=AIza ....”
当我执行时,代码会中断,而不会被异常捕获:
代码是:
std::stringstream get_response(std::string_view url)
{
std::stringstream str;
curl::curl_ios<std::stringstream> writer(str);
curl::curl_easy easy(writer);
easy.add<CURLOPT_URL>(url.data());
easy.add<CURLOPT_FOLLOWLOCATION>(1L);
easy.add<CURLOPT_VERBOSE>(1L);
try
{
easy.perform();
}
catch (curl::curl_easy_exception error)
{
auto errors = error.get_traceback();
error.print_traceback();
}
return str;
}
我看过几个站点都没有成功。
任何帮助将不胜感激
答案 0 :(得分:0)
我从日志中获得了更多信息:
...
schannel: SSL/TLS connection with maps.googleapis.com port 443 (step 2/3)
schannel: encrypted data got 778
schannel: encrypted data buffer: offset 3542 length 4096
schannel: next InitializeSecurityContext failed: Unknown error (0x80092013) -The revocation function was unable to check revocation because the revocation server was offline.
Marked for [closure]: Failed HTTPS connection
....
如何解决这个问题?
谢谢