Skip Menu |

This queue is for tickets about the libwww-perl CPAN distribution.

Report information
The Basics
Id: 40917
Status: resolved
Priority: 0/
Queue: libwww-perl

People
Owner: Nobody in particular
Requestors: shaohua [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 5.810
Fixed in: (no value)



Subject: a possible bug in HTTP::Cookies::Microsoft?
I use $VERSION = "5.810" of Cookies::Microsoft in ActivePerl 5.8, but find sometimes the cookie added to request is not complete: for example, when the target is books.google.cn, only books.google.cn cookie is added, but not google.cn. I tracked down to a line reading cookie files from index.dat, which is in sub load(): if ($data =~ /Cookie\:$user_name\@([\x21-\xFF]+).*? ($user_name\@[\x21-\xFF]+\.txt)/) my user name is "shaohua li", but the browser stores google.cn's cookie in "shaohua_li@google[5].txt", as filemon reveals. So here is a mismatch and this entry is skipped. I'd like to patch this line as: my $user_name2 = $user_name; $user_name2 =~ s/ /_/g; if ($data =~ /Cookie\:$user_name\@([\x21-\xFF]+).*?((:?$user_name|$user_name2)\@ [\x21-\xFF]+\.txt)/) I guess this might cover all situations.
Thanks for your report. Attached is the patch I've applied.
commit c8dad6b7c3cee8e423c6646f5a3422a743ba50a8 Author: jefflee <shaohua@gmail.com> Date: Mon Nov 24 21:18:49 2008 +0100 HTTP::Cookies::Microsoft now handles user names with space [RT#40917] I use $VERSION = "5.810" of Cookies::Microsoft in ActivePerl 5.8, but find sometimes the cookie added to request is not complete: for example, when the target is books.google.cn, only books.google.cn cookie is added, but not google.cn. I tracked down to a line reading cookie files from index.dat my user name is "shaohua li", but the browser stores google.cn's cookie in "shaohua_li@google[5].txt", as filemon reveals. So here is a mismatch and this entry is skipped. diff --git a/lib/HTTP/Cookies/Microsoft.pm b/lib/HTTP/Cookies/Microsoft.pm index 0c2614c..cb8129b 100644 --- a/lib/HTTP/Cookies/Microsoft.pm +++ b/lib/HTTP/Cookies/Microsoft.pm @@ -225,7 +225,8 @@ sub load } } - if ($data =~ /Cookie\:$user_name\@([\x21-\xFF]+).*?($user_name\@[\x21-\xFF]+\.txt)/) + (my $user_name2 = $user_name) =~ s/ /_/g; + if ($data =~ /Cookie\:\Q$user_name\E\@([\x21-\xFF]+).*?((?:\Q$user_name\E|\Q$user_name2\E)\@[\x21-\xFF]+\.txt)/) { my $cookie_file = $cookie_dir . $2; # form full pathname