libcurl如何支持https

来源:互联网 发布:某交友社区2千万数据 编辑:程序博客网 时间:2024/06/07 08:51

默认情况下,libcurl不支持https, 如果使用https链接,就会出现" Protocol https not supported or disabled in libcurl" 的错误提示。

curl有两种方式使用https :

1. 设定为不验证证书和HOST

code = curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0L);



2. 设定一个SSL判别证书

http://curl.haxx.se/ca/cacert.pem