| |
|
|
|
cURL Mailing List Monthly Index Single Mail
curl-library Mailing List Archives
RE: Using options CURLOPT_COOKIEFILE & CURLOPT_COOKIEJAR
From: Edward Chan <echan_at_macromedia.com>
Date: Wed, 3 Sep 2003 15:26:59 -0700
> > However, I find that some times, the http request fails. I noticed
Sorry, my bad; the actual call to curl_easy_perform() isn't failing...But the results are not as expected.
>
That's what I thought. But I thought maybe curl handled this internally. But after stepping through the code, it appears that it tries to lock the cookie file before modifying it. But there is no share setup, so it immediately returned without acquiring any kind of lock. So now, I've set up a share, and setup the lock and unlock callbacks, passing it a mutex that is acquired when lock is called, and released when unlock is called. So the shared resource is now protected.
>
I guess I would have liked to see a section discussing the calls curl_share_init(), curl_share_setopt(), and curl_share_cleanup(). I had to modify the .def file in order for the API's to be built into the libcurl.dll.
>
Perhaps this is where my problem lies. I have been using the "easy" interface because it was easy to get started with it. I never use the same curl handle in 2 different threads, and the only place I have a shared resource that curl needs to access is the cookie file. So I think I'm ok as long as I setup the share and have the lock/unlock callbacks to protect it.
>
Yes, it does. Thanks very much. I have one last question though. I guess I can look into the code to figure this out, but if you can tell me off hand, that would be great. I've seen that in curl_easy_cleanup(), writing to the cookie file is protected around lock/unlock. I'm assuming the same is done in other places that need to access the cookie file?
Thanks for you help,
-------------------------------------------------------
These mail archives are generated by hypermail. |
Page updated November 12, 2010.
web site info