Problem with Https CURL getting very slower response than http curl - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Problem with Https CURL getting very slower response than http curl

sh2012apssh2012aps Posts: 1Member
i am using the
url = "https://prd.aps.net/cm/json/login.json?username=aps@aps.com&pass=ca4433$$&apikey=1dd80ss107s3ad9593c857cc6d14d3a3"

Note:: if iam using the http as a protocol it just grab the values in a few seconds(3 to 4) but using https its a big issue around 40 sec it takes when i am calling curl_easy_perform(curl) why so? please take a part in it.
Thanks.

my code snippet is as follows please try to find if anyone knows better.


curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();

struct data config;
config.trace_ascii = 1; /* enable ascii tracing */
struct curl_slist *chunk = NULL;
curl_slist_append( chunk, "Content-Type: application/json");

curl = curl_easy_init();

struct AppMemoryStruct chunk1;
chunk1.memory = (char *)malloc(1); /* will be grown as needed by the realloc above */
chunk1.size = 0; /* no data at this point */

if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, url.GetPlatformString().c_str());

curl_easy_setopt(curl,CURLOPT_SSLCERTTYPE,"PEM");
curl_easy_setopt(curl, CURLOPT_SSLCERT, "C:\test\omg.aps.net.pem");

curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2);
curl_easy_setopt(curl,CURLOPT_KEYPASSWD,"");


//curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace);
//CA("JL1l");
//curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &config);
//CA("JL1m");
//curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
//CA("JL1n");

char error[1024];
curl_easy_setopt ( curl, CURLOPT_ERRORBUFFER, error );


/* send all data to this function */
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &AppWriteMemoryCallback);

/* we pass our 'chunk' struct to the callback function */
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk1);

/* some servers don't like requests that are made without a user-agent
field, so we provide one */
//curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");

//curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
//curl_easy_setopt(curl, CURLOPT_HTTPGET,1);

//heres the performance get down its around 40 seconds to call the server

res = curl_easy_perform(curl);
//
if(CURLE_OK != res)
{

errorCode = kFalse;

if(chunk1.memory)
{

free(chunk1.memory);
}
curl_easy_cleanup(curl);
return errorCode;
}
errorCode = kTrue;

if(chunk1.memory)
{

returndata.SetCString(chunk1.memory);
free(chunk1.memory);

}


/* always cleanup */
curl_easy_cleanup(curl);curl_global_init(CURL_GLOBAL_ALL);



Thanks
Sign In or Register to comment.