I upgraded my version to 5.64 but everything kept the same.
I have looked into Cookies.pm to see how I could fix it.
What I found out was that not only the Version=1 was giving me
problems but als the "" around the entries + the path which is
added to the cookie.
After testing some solutions here is my best one:
$cookie_jar->{'hide_cookie2'} = 1;
Add to the Cookies.pm: (sorry no diff didn't save the orig)
157 unless ($found) {
158 LWP::Debug::debug(" port $port:$req_port
does not fit");
159 next;
160 }
161 }
162 $version = $self->{set_version};
163 if ($version > 0 && $netscape_only) {
164 LWP::Debug::debug(" domain $domain
applies to " .
165 "Netscape-style cookies only");
166 next;
Only line 162 is added by myself ...
And use in the program:
$cookie_jar->{'set_version'} = 0;
If I do it this way everything is working fine and also like all other
browsers. So it looks like the browsers only implemented version 0
of cookies and are discarding cookies2 ....
Hope the extra option can be added in the future release so you
can configure your program to act like a normal browser.
Regards,
Luuk
On 16 May 2002, at 6:25, Gisle Aas wrote:
> "Luuk de Boer" <[EMAIL PROTECTED]> writes:
>
> > On 15 May 2002, at 7:04, Gisle Aas wrote:
> >
> > > "Luuk de Boer" <[EMAIL PROTECTED]> writes:
> > >
> > > > I am busy making a program to get everything from a website
> > > > which is using cookies. When I use $ua->cookie_jar($cookie_jar);
> > > > he picks up the cookie I get (sessionid) places it in the next
> > > > header. That's working fine but the syntax is completely
> > > > different as normal browsers are doing. When do above the header
> > > > I get is: Cookie: $Version=1; JSESSIONID="iibuorkp41.JS11";
> > > > $Path="/memberarea"
> > > >
> > > > and when I do the some stuff with mozilla or IE 6.0 or something
> > > > else I get: Cookie: JSESSIONID=8szullke51.JS13
> > > >
> > > > only the way the browser is using is working on that website.
> > >
> > > What are the Set-Cookie (and Set-Cookie2) headers that are sent
> > > from the server in this case? What version of LWP are you using?
> > > Also a dump of $ua->cookie_jar->as_string would be nice to see.
> > >
> > > The first format (with $Version=1 etc) is only supposed to be
> > > returned if the server says it accept that kind of cookies, by
> > > using the Set-Cookie2 header.
> > >
> >
> > Here the set cookie headers:
> > Set-Cookie: JSESSIONID=qqxmisgbf1.JS12;Path=/memberarea
> > Set-Cookie2:
> > JSESSIONID=qqxmisgbf1.JS12;Version=1;Discard;Path="/memberarea"
> >
> > version I am using is: LWP.pm = 5.53
> >
> > and a dump of the cookie as_string :
> > Set-Cookie3: JSESSIONID="0ga3rtgc91.JS12";
> > path="/memberarea"; domain="www.woonkrant.nl"; path_spec;
> > discard; version=1
>
> In which case it is totally correct to send back the Cookie in the RFC
> 2965 format; Cookie: $Version=1; JSESSIONID="qqxmisgbf1.JS12"; ...
>
> Are you sure it is not some other cookies that are the problem? Since
> your version of LWP there has been some updates to the HTTP::Cookie
> module that might be relevant here. For instance this one:
>
> Fix HTTP::Cookies where there is a mix of Set-Cookie and
> Set-Cookie2 headers. In that case we used to ignore all
> Set-Cookie headers. Now we only ignore those Set-Cookie headers
> that reference the same cookie as a Set-Cookie2 header.
>
> If you don't feel like upgrading the whole of LWP you might try to
> just plug in http://www.linpro.no/lwp/libwww-perl/lib/HTTP/Cookies.pm
> and see if that helps.
>
> I also wonder if it would make sense to add an option to HTTP::Cookies
> to simply make it ignore any Set-Cookie2 headers found in requests. If
> no real browser is ever going to implement RFC 2965 cookies, then
> there is bound to be server apps out there that end up in some trouble
> with them.
>
> Regards,
> Gisle