cURL / Mailing Lists / curl-library / Single Mail

curl-library

Share interface

From: Andrés García <fandom_at_retemail.es>
Date: Thu, 1 Jul 2004 20:04:43 +0200

Hi,

I guess I am not reading the documentation right, since I am not able to get
even simple programs working with the share interface.

Could you please tell why the following program causes a segmentation
fault when 'curl_share_cleanup' is called?

Thanks,
Andres

int main(void)
{
  CURL *curl1, *curl2;
  CURLSH *sHandle;
  
  curl_global_init( CURL_GLOBAL_ALL );

  sHandle=curl_share_init();
  
  curl1 = curl_easy_init();
  curl2 = curl_easy_init();

  curl_share_setopt(sHandle,CURLSHOPT_SHARE,CURL_LOCK_DATA_DNS);
  
  curl_easy_setopt(curl1, CURLOPT_URL, "strider.asturias.es");
  curl_easy_setopt(curl1, CURLOPT_SHARE, sHandle);
  
  curl_easy_setopt(curl2, CURLOPT_URL, "strider.asturias.es/~andres/");
  curl_easy_setopt(curl2, CURLOPT_SHARE, sHandle);
      
  curl_easy_perform(curl1);
  curl_easy_perform(curl2);
    
  curl_easy_cleanup(curl1);
  curl_easy_cleanup(curl2);
  
  curl_share_setopt(sHandle,CURLSHOPT_UNSHARE,CURL_LOCK_DATA_DNS);
  
  curl_share_cleanup(sHandle);
  curl_global_cleanup();

  return 0;
}
Received on 2004-07-01