Dear Mikhael,

Regarding the Transient-ness of the cookie:
* Yes, ->as_string does indeed show the cookie as "discard":
  Set-Cookie3: ASP.NET_SessionId=kquo3aujf3l4m2q43kru3lmd; path="/";
  domain=www.magna.isa.gov.il; path_spec; discard; HttpOnly; version=0
* Adding "ignore_discard => 1" to the constructor method indeed solved the
problem and a cookie was saved!
* It seems to me that the Mozilla FireFox does a similar ignore discard
since the same cookie is saved and returned on all subsequent sessions.
* To the best of my knowledge, this behavior is not documented, at 
  least not in
http://search.cpan.org/~gaas/libwww-perl-5.836/lib/HTTP/Cookies.pm.

Problem solved!
Thanks!

Meir

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of Mikhael Goikhman
Sent: Monday, June 28, 2010 1:10 PM
To: Perl in Israel
Subject: Re: [Israel.pm] LWP and the Jewish/Hebrew question

On 28 Jun 2010 12:21:37 +0300, Meir Guttman wrote:
> 
> The LWP (Lib WWW for Perl) package seems to be very unfriendly or
> even right out hostile to Unicode, RTL text or just Hebrew.

I can't say that I can agree with this. :)

> There are many examples. For one: the HTML::TreeBuilder package
> ->Dump and ->as_HTML methods totally garble Hebrew UTF-8 text.

Maybe it is garbled by your text viewer or web browser when you
view unmarked text with mixed direction parts?

Without an example it is difficult to believe that HTML::TreeBuilder
does something special with Hebrew.

> But let's start first with a very simple Cookie_jar case which I
> first posted
> <http://www.mail-archive.com/[email protected]/msg06768.html> on the
> [email protected] mailing list (with no results!) The following code
> to the Google site suggested by the LWP originator and maintainer
> Gisle Aas worked fine:
> 
> use LWP::UserAgent;
> 
> use HTTP::Cookies;
> 
> my $jar = HTTP::Cookies->new(file => "lwp.jar", autosave => 1);
> 
> my $ua = LWP::UserAgent->new(cookie_jar => $jar);
> 
> $ua->get("http://www.google.com";)->dump;
> 
> And indeed, it fills the 'lwp.jar' file with a few entries.
> 
> But just changing the URL to http://www.magna.isa.gov.il
> <http://www.magna.isa.gov.il/>  produced a cookie jar file with just a
> comment headline and no entries at all.
> 
> As you might see for yourself, the MAGNA site does send a Set-Cookie:
> ASP.NET_SessionId=ddkkv245c14tol45bgk35m45; path=/; HttpOnly line.
> 
> So, in the spirit of the last week's events, why is the Israeli site
> discriminated against???

Maybe because this site defines such behaviour? :)

The cookie set by this page is transient (i.e. valid for one session
only), because it does not contain the "expires" field.

So HTTP::Cookies correctly does not store it in the persistent cookie
file "lwp.jar" specified by you.

But although temporary cookies are not stored in the persistent
cookie files, they still take effect. You can verify this by:

  print $jar->as_string;

Regards,
Mikhael.

-- 
perl -e 'print+chr(64+hex)for+split//,d9b815c07f9b8d1e'
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to