晚上好,
我需要将 libCurl 实现到我们的 Android 项目之一中。我使用 JNI 通过 libCurl 代码调用 C++ 类。一切都很完美,但看在上帝的份上,我无法使用 https url 让它工作。
我总是收到 CURLE_UNSUPPORTED_PROTOCOL 错误。
我在用着这个预构建的curl库与 SSL
我的 C++ 代码如下所示:
curl_easy_setopt(curl, CURLOPT_URL, "https://www.es....");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, (void *)&cbProgress);
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_func);
curl_easy_setopt(curl, CURLOPT_SSLVERSION, 3);
status = curl_easy_perform(curl);
我在 iOS 上使用相同的代码,并且它与 https 一起工作得很好。
同样,使用 http url 就可以了。
任何帮助真的很感激!
From libcurl 错误联机帮助页:
CURLE_UNSUPPORTED_PROTOCOL (1)
The URL you passed to libcurl used a protocol that this libcurl
does not support. The support might be a compile-time option
that you didn't use, it can be a misspelled protocol string or
just a protocol libcurl has no code for.
The compile-time option
这是这一点的重要收获。因此,测试您正在使用的库curl_version_info()
(联机帮助页here) 来查看它是否包含SSL
支持与否。图书馆文档可能会说它有SSL
支持,但请确认。如果不包含SSL
支持,那就不行https
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)