如何解决使用 libcurl 时出现“SSL CA 证书问题”错误
我使用 --openssldir=/ssl(链接到 /etc/ssl)构建了 openssl 1.1.1,并使用 --with-ssl= 构建了 curl 7.76.1。 编译如下代码:
Client Session Max
当我运行此代码时出现错误:
#include <iostream>
#include <curl/curl.h>
int main()
{
CURL *curl = curl_easy_init();
if (curl)
{
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers,"Accept: */*");
headers = curl_slist_append(headers,"Content-Type: application/json");
curl_easy_setopt(curl,CURLOPT_HTTPHEADER,headers);
curl_easy_setopt(curl,CURLOPT_URL,"https://<address>");
curl_easy_setopt(curl,CURLOPT_POST,1);
curl_easy_setopt(curl,CURLOPT_POSTFIELDS,"<some data>");
curl_easy_perform(curl);
curl_slist_free_all(headers)
}
curl_easy_cleanup(curl);
}
我在 strace 中看到,它正在尝试打开“/etc/pki/tls/certs/ca-bundle.crt” 但是在我的机器(Ubuntu 12 和 Ubuntu 14)中没有文件夹“/etc/pki”。 为什么 curl 使用“/etc/pki”而不是“/etc/ssl”?如何强制它使用“/etc/ssl”? 我尝试使用 --without-nss 构建 curl,但没有成功。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。