Re: Cookies for LWPng & more
Tan Joo Geok (tjg@krdl.org.sg)
Fri, 15 Sep 2000 10:09:38 +0800
It works fine now. Thanks a lot!
I moved on to try if LWPng can do https as well using a https URL($url =
"https://www.nodeworks.com") in the code below and got the following error
message:
590 No handler for 'https' scheme
I am sure that my system is set up properly to do https because the original
lwp-request from libwww works fine with a https URL. The problem seems to
be with LWPng. Can LWPng do https? If not, what must one do to make it do
so?
Thank you for the attention.
Regards,
Joo Geok
----- Original Message -----
From: Gisle Aas <gisle@activestate.com>
To: Tan Joo Geok <tjg@krdl.org.sg>
Cc: <libwww@perl.org>
Sent: Thursday, September 14, 2000 6:47 PM
Subject: Re: Cookies for LWPng
> "Tan Joo Geok" <tjg@krdl.org.sg> writes:
>
> > I have been using the LWPng distribution which implements HTTP/1.1. I
am wondering how to get the Cookie operations working for LWPng. I tried
doing this:
> >
> >
> > #!/usr/bin/perl -w
> >
> > require LWP;
> > require LWP::Debug;
> >
> > use LWP::UA;
> > use LWP::UA::Cookies;
> > use LWP::Request;
> > use LWP::MainLoop qw(mainloop);
> > use HTTP::Cookies;
> >
> > $ua = LWP::UA->new;
> > $ua->agent("Mozilla/8.0");
> > $ua->cookie_jar(HTTP::Cookies->new);
> >
> > $url = "http://www.hotmail.com";
> > $timeout = 3*60;
> > $request = LWP::Request->new("GET");
> > $request->{'done_cb'} = sub { $response = shift;};
> > $request->url($url);
> > $ua->spool($request);
> > mainloop->one_event($timeout) until $response;
> > if ($response)
> > {
> > print "Main page done for $url\n";
> > if ($ua->cookie_jar->as_string)
> > {
> > print "Cookies found\n";
> > }
> > else
> > {
> > print "No Cookies found\n";
> > }
> > }
> >
> >
> > The error message I get is:
> >
> > Can't locate object method "epath" via package "URI::http" at
/usr/lib/perl5/site_perl/5.005/HTTP/Cookies.pm line 110.
> >
> > Does anybody know what is the problem?
>
> The problem is URI::URL --> URI migration. LWPng use URI while LWP5
> still use the old URI::URL interface.
>
> The epath() method of URI::URL is basically the same as path() of URI,
> while path() in URI::URL is different. Therefore I can't just change
> HTTP::Cookies to call path.
>
> Try to add a:
>
> sub URI::epath { shift->path(@_); }
>
> to you application.
>
> Regards,
> Gisle