cURL / Mailing Lists / curl-library / Single Mail

curl-library

SSL_shutdown crashes

From: Ganesh Ragavan <ganeshragavan_at_gmail.com>
Date: Thu, 17 Sep 2009 17:44:37 -0700

Hello,

I am trying to run the following piece of code (I created this code to
narrow down my problem). The code does the job for 1000 iterations in
the while loop. In the while loop, after the
sleep (1001 th iteration), the code crashes at the line
curl_easy_perform(curl_desc). I added some debug statements into the
libcurl code and I see the code crashing at the following place.

file: curl-7.18.2\lib\ssluse.c
function : void Curl_ossl_close(struct connectdata *conn, int sockindex)
line: (void)SSL_shutdown(connssl->handle);

int
main(int nargs,
         char *args[])
{
        CURL *curl_desc;
        FILE * pFile;
        int i=1;

        curl_desc = curl_easy_init();

        curl_easy_setopt(curl_desc, CURLOPT_FOLLOWLOCATION,1);
        curl_easy_setopt(curl_desc, CURLOPT_TIMEOUT, CD_TIMEOUT_VALUE_SEC);
        curl_easy_setopt(curl_desc, CURLOPT_CONNECTTIMEOUT, CD_TIMEOUT_VALUE_SEC);
        curl_easy_setopt(curl_desc, CURLOPT_FAILONERROR, 1);
        curl_easy_setopt(curl_desc, CURLOPT_USERPWD, "testuser123:Ph0enix08");
        curl_easy_setopt(curl_desc, CURLOPT_SSL_VERIFYPEER, 0);
        curl_easy_setopt(curl_desc, CURLOPT_SSL_VERIFYHOST, 0);

        while (1)
        {
                i++;
                pFile = fopen ("tmpfile","w");

                /* set options for a curl easy handle */
                curl_easy_setopt(curl_desc, CURLOPT_RANGE, "0-");
                curl_easy_setopt(curl_desc, CURLOPT_WRITEDATA, pFile);
                curl_easy_setopt(curl_desc, CURLOPT_URL,
"https://fd86:8baa:b243:202::2023:443/data");
                curl_easy_perform(curl_desc);

                if ((i % 1000) == 1)
                        sleep(600);
                
                fclose(pFile);
        }

        return 1;
        
}

Could someone please let me know if I am missing something here.

Thanks,
G
Received on 2009-09-18