Subject: | Bug with handling of double quote for version 1 cookies |
Date: | Sun, 4 Sep 2011 11:32:10 -0700 (PDT) |
To: | "bug-HTTP-Cookies [...] rt.cpan.org" <bug-HTTP-Cookies [...] rt.cpan.org> |
From: | Sergey Kolychev <ksv_work [...] yahoo.com> |
Hello there,
There seems to be a bug in how HTTP::Cookies (current module) works with
version 1 cookies that forces me to subclass the HTTP::Cookies and
redefine
its behaviour any time I encounter a site that uses version 1 cookies (thankfully not many use them).
Any chance it can be fixed somehow ?
This block
-------------------------------------------------------------------------
my($k,$v) = split(/\s*=\s*/, $param, 2);
if (defined $v) {
$v =~ s/\s+$//;
#print "$k => $v\n";
}
else {
$k =~ s/\s+$//;
#print "$k => undef";
}
-------------------------------------
used to extract cookies from the response header keeps leading and ending double quotes
of the cookie value if the response header has them.
Then
this block:
---------------------------------------
# do we need to quote the value
if ($val =~ /\W/ && $version) {
$val =~ s/([\\\"])/\\$1/g;
$val = qq("$val");
}
---------------------------------------
adds redundant leading and ending double quote resulting in incorrect cookie value
that looks like
foo="\"bar\""
Thank you.
Reply to:
Reply to Sergey Kolychev Reply to Sergey Kolychev Send