cURL / Mailing Lists / curl-users / Single Mail

curl-users

The HTTPS CURL get slower than HTTP CURL

From: Sagar Hagawne <shagawne_at_apsiva.com>
Date: Fri, 16 Nov 2012 18:19:34 +0530

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);
    
     
     please try to find a key issue why the performance is very bad using https curl.

Thanks,

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-11-16