Reputation: 315
Good evening,
I need to implement libCurl into one of our Android projects. I use JNI to call the c++ class with the libCurl code. Everything works just perfect but for the love of god I can't get it to work using a https url. I always get the CURLE_UNSUPPORTED_PROTOCOL error.
I'm using this prebuild curl library with SSL
My c++ code looks like this:
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);
I use the same code for iOS and it works fine with https. Again, using a http url works just fine.
Any help is truly appreciated !!
Upvotes: 1
Views: 3088
Reputation: 374
You need compile libcurl.so with "--with-ssl"
Which is really suffering. Refer "http://ieroot.com/2015/03/29/1728.html", may help you .
Upvotes: 0
Reputation: 3540
From libcurl errors manpage:
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
is the important takeaway of this. So, test the library that you're using with curl_version_info()
(manpage here) to see if it contains SSL
support or not. The library doc may say it has SSL
support, but please confirm. If it doesn't contain SSL
support, then no https
.
Upvotes: 1