curl connect https CURLE_UNSUPPORTED_PROTOCOL

I use cocos2d-x 2.0 ,

void HelloWorld::dohttps(const char url,const chardata){
CURL curl;
CURLcode res;
int result = 1;
string buffer;
curl_global_init;
curl = curl_easy_init;
if
{
curl_slist
plist = curl_slist_append(NULL, “Content-Type: text/xml;charset=UTF-8”);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, plist);
res=curl_easy_setopt( curl, CURLOPT_URL, url );
//设定为不验证证书和host
res=curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1);
if(res!=CURLE_OK)
{
return ;
}
res=curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2);
if(res!=CURLE_OK)
{
return ;
}
//res=curl_easy_setopt(curl,CURLOPT_HEADER,1);
//res=curl_easy_setopt(curl,CURLOPT_CAINFO,pCACertFile);
//res=curl_easy_setopt(curl, CURLOPT_POST, 1);//启用POST提交
//res=curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res=curl_easy_setopt( curl, CURLOPT_FOLLOWLOCATION, 1L );
res=curl_easy_setopt( curl, CURLOPT_WRITEFUNCTION, HelloWorld::writer );
res=curl_easy_setopt( curl, CURLOPT_WRITEDATA, &buffer );
res=curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); // Used to debug
//curl_easy_setopt(curl, CURLOPT_STDERR, pFILE_error_info); // save error info in the file or stderr
//curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error_buff); // error_buff used to save error info
//res=curl_easy_setopt(curl, CURLOPT_RETURNTRANSFER, 1);
res = curl_easy_perform( curl );
curl_easy_cleanup( curl );
std::string result=buffer.c_str();
CCLog(“gggggggggg=%s”,result);
}
}

// do test
std::string httpsurl=“https://login.taobao.com/member/login.jhtml”;
dohttps(httpsurl.c_str(),httpsdata.c_str());

//but return CURLE_UNSUPPORTED_PROTOCOL,I don’t know why?
is cocos2d-x 2.0 support https?
is here someone help me?

is anyone have solution?

Please refer to the source code of CCHttpClient & CCHttpRequest in v2.0.2, extensions folder.

Walzer Wang wrote:

Please refer to the source code of CCHttpClient & CCHttpRequest in v2.0.2, extensions folder.

oh, i get it

Hi,

I encounter the same problem to access a https url.
I had a look to CCHttpClient and CCHttpClientRequest, try the code example but get the message :

Protocol https not supported or disabled in libcurl
I didn’t find anything about https in the source code

@Martin sue : could you share your solution ?

Thanks

I’d like to chime in here, since we just stumbled upon the same problem. Apparently the liburl used by cocos2d-x has not been configured to enable https calls. Does anyone have an idea how to fix that?

“Protocol https not supported or disabled in libcurl”

Any fix for this?

Update:
I replaced the existing URL in the Extensions Test of TestCpp and I still get the same output “Protocol https not supported or disabled in libcurl”.