?
Solved

Sharing cookie information with libcurl handles

Posted on 2005-02-24
6
Medium Priority
?
890 Views
Last Modified: 2008-01-09
I'm using the libcurl library with Perl, and have a need to use multiple curl handles. For example:

-----
#!/wms/bin/perl

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}}
0
Comment
Question by:timdr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 20

Expert Comment

by:jmcg
ID: 13417310
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).
0
 
LVL 1

Author Comment

by:timdr
ID: 13432179
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!
0
 
LVL 20

Expert Comment

by:jmcg
ID: 13434773
I guess it's either that, or figuring out if your needs can be met using Perl's LWP instead of libcurl.
0
 
LVL 1

Author Comment

by:timdr
ID: 13443341
That isn't an option in this case.
0
 
LVL 1

Accepted Solution

by:
timdr earned 0 total points
ID: 13460767
Considering there is no activity in this thread, you are welcome to close this question.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question