cURL / Mailing Lists / curl-library / Single Mail

curl-library

CURL :: The headre len is not cleared between subsequent calls to curl_easy_perform() unless we call curl_easy_init() and curl_easy_cleanu p()

From: Krishnendu Majumdar <KMajumdar_at_etrade.com>
Date: Fri, 25 Jan 2002 13:36:40 -0500

Hi ,
First of all We would want to thank You for this beautiful utility . We just
love its features and capabilities , and best of all ease of use .
We are facing a problem though .
Platform :: curl version 7.92 .
OS :: SunOS 5.7
We have a program like this ::
****************************************************************************
*********
url = getURLfromcommandline();
curl_global_init(CURL_GLOBAL_DEFAULT)
curl = curl_easy_init() ;

for ( int i= 0; i < numiteration ; i++ )
 {
     curl_easy_setopt(curl,
     curl_easy_setopt(*curl, CURLOPT_HEADER, 1);
     curl_easy_setopt(*curl, CURLOPT_USERAGENT, "CURL");
     curl_easy_setopt(*curl, CURLOPT_COOKIEFILE, gcookiefile);
    curl_easy_setopt(*curl, CURLOPT_FOLLOWLOCATION, 1);
    curl_easy_setopt(*curl, CURLOPT_WRITEFUNCTION, eturl_data_return);
    curl_easy_setopt(*curl, CURLOPT_FILE, (void *)outBuff);
    curl_easy_setopt(*curl, CURLOPT_URL, url);

     ret = curl_easy_perform(*curl) ;
   if ( ret != CURLE_OK)
    return FAILURE ;
    
    curl_easy_getinfo(*curl,CURLINFO_HEADER_SIZE,&(mem->header_len));
    printf( " THe HEADER LENGTH is %d\n",mem->header_len);
}

curl_easy_cleanup(curl ) ;
curl_global_cleanup() ;
}
****************************************************************************
**
The header len seems to be cumulatively adding up . The result looks like ::
THE HEADER LENGTH is 100
THE HEADER LENGTH is 200
THE HEADER LENGTH is 300
THE HEADER LENGTH is 400
THE HEADER LENGTH is 500 .... for the same site .

** The way we have solved it for now , is to call curl_easy_init() and
curl_easy_cleanup() each time .
Though the header length is wrong in our test , there seems to be a
significant performance gain in not calling curl_easy_init() all the time .
We found some input in http://curl.haxx.se/mail/lib-2001-01/0021.html
 . But that was long back ( JAnuary 2001 ) . I was wondering whether this
problem has already been solved .

Regards ,
Krish/Joel

    

Krishnendu Majumdar
E*TRADE. It's your money
kmajumdar_at_etrade.com
650-331-6381.
Received on 2002-01-26