【发布时间】:2015-11-29 08:26:48
【问题描述】:
晚上好,
我需要在我们的一个 Android 项目中实现 libCurl。我使用 JNI 调用带有 libCurl 代码的 c++ 类。一切都很完美,但看在上帝的份上,我无法使用 https url 让它工作。 我总是收到 CURLE_UNSUPPORTED_PROTOCOL 错误。
我正在使用 this prebuild curl library 使用 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 效果很好。
非常感谢任何帮助!
【问题讨论】:
标签: android android-ndk libcurl