Hi there,
We've found that LWP incorrectly handles cookies
containing ';' in the cookie value.
The patch (test case and fix) is attached
Sincerely,
Aleksandr Guidrevitch
diff -ur /home/ag/.cpan/build/libwww-perl-5.76/lib/HTTP/Cookies.pm
/home/ag/development/libwww-perl-5.76/lib/HTTP/Cookies.pm
--- /home/ag/.cpan/build/libwww-perl-5.76/lib/HTTP/Cookies.pm 2003-10-23 22:11:32
+0300
+++ /home/ag/development/libwww-perl-5.76/lib/HTTP/Cookies.pm 2004-03-30 21:17:20
+0300
@@ -217,7 +217,15 @@
my @cur;
my $param;
my $expires;
- for $param (split(/;\s*/, $set)) {
+
+ my @quoted = split(/(?<!\\)\"/, $set);
+ my @param;
+ for ([EMAIL PROTECTED]/2) {
+ push @param, split /;\s*/, $quoted[$_*2];
+ $param[-1] .= '"' . $quoted[$_*2+1] . '"' if defined $quoted[$_*2+1];
+ }
+
+ for $param (@param) {
my($k,$v) = split(/\s*=\s*/, $param, 2);
if (defined $v) {
$v =~ s/\s+$//;
diff -ur /home/ag/.cpan/build/libwww-perl-5.76/t/base/cookies.t
/home/ag/development/libwww-perl-5.76/t/base/cookies.t
--- /home/ag/.cpan/build/libwww-perl-5.76/t/base/cookies.t 2003-10-15 14:43:27
+0300
+++ /home/ag/development/libwww-perl-5.76/t/base/cookies.t 2004-03-30 21:17:38
+0300
@@ -1,4 +1,4 @@
-print "1..41\n";
+print "1..42\n";
#use LWP::Debug '+';
use HTTP::Cookies;
@@ -646,6 +646,22 @@
print "ok 41\n";
+$req = HTTP::Request->new(GET => "http://1.1.1.1/");
+$req->header("Host", "www.acme.com:80");
+
+$res = HTTP::Response->new(200, "OK");
+$res->request($req);
+$res->header("Set-Cookie",
"re=\"####\$####`####`||####(####(####\\\";|7_]<O|##\$RP7STO[|\"; path=/;
expires=Wednesday, 09-Nov-$year_plus_one 23:12:40 GMT");
+$c->extract_cookies($res);
+
+$req = HTTP::Request->new(GET => "http://www.acme.com/");
+$c->add_cookie_header($req);
+
+$h = $req->header("Cookie");
+print "not " unless
+ $h =~
/re=\"####\$####`####`\|\|####\(####\(####\\\";\|7_\]<O\|##\$RP7STO\[\|\"/;
+print "ok 42\n";
+
#-------------------------------------------------------------------
sub interact