Sharing cookie information with libcurl handles

I'm using the libcurl library with Perl, and have a need to use multiple curl handles. For example:


use WWW::Curl::easy;

my $curl1 = WWW::Curl::easy->new();
my $curl2 = WWW::Curl::easy->new();

Unfortunately, each of these curl handles uses its own set of cookies. I need to share the cookie information between the two handles. I know that with the regular C libcurl library you can, but the perl interface doesn't seem to have access to it.

I am looking for either someone that knows how to access this interface through perl, or knows a another way to do this.

Some things to note:
- Using the COOKIEJAR or COOKIEFILE doesn't seem to help with this problem.
- The option to do this C is called CURLOPT_SHARE, but doesn't seem to do anything using it in Perl.
- In the real application, each curl handle is in its own thread. So the solution must be thread safe.

{{500 points refunded - PAQ - jmcg - EE Page Editor for Perl}}
Who is Participating?
timdrConnect With a Mentor Author Commented:
Considering there is no activity in this thread, you are welcome to close this question.
Based on the documentation I've been able to find, a threadsafe version of curl_share doesn't exist yet and there's no access to it from the WWW::Curl::easy wrappers. Someone who is more up-to-date with this software may be able to contradict this impression (I certainly don't know for certain that what I'm finding is current documentation).
timdrAuthor Commented:
If that is the case, then I need to figure out another way to handle cookies. The worst case scenario would be that I have to handle them manually myself, parsing the headers and adding in cookie headers to each request.

This type of help really requires someone thats pretty familiar with libcurl and using it through perl, so I'd be surprised if anyone could really help with this.

Thanks for the effort so far though!
I guess it's either that, or figuring out if your needs can be met using Perl's LWP instead of libcurl.
timdrAuthor Commented:
That isn't an option in this case.
All Courses

From novice to tech pro — start learning today.