1 Reply Latest reply on Nov 30, 2012 8:49 AM by Peter Spier

    InDesign problem With Https cURL Seems Very Slow at first time  to handshaking to server

    sh2012.aps

      I am trying to connect the server using cURL from Indesign, but when i am trying to call to server the indesign takes so much time to open and initialize the socket it takes 25 seconds at first time only, but On all subsequent calls it is fast,

       

      *but when i am tryid that same programe with an c++ empty project it is very fast in 2 second we get a result back,

       

      *So the Problem With Indesign Socket initialization using https at first time because i have tryid same Curl On Simple c++ program and it is fast at all calls

       

      Specification:

      I am Currently using

           Indesign cs7 version 9.0

           visual studio 2010

          

      Can Anyone tell me why It happens,

       

      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,"");
            
           
                 
                   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 25 seconds when i am calling The server Using Curl Object Having

           //https url 
                     
                  res = curl_easy_perform(curl);
          // till here
                   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.

      Thanks,