[Rt-devel] [PATCH] (#4638) cli cookie handling
Jesse Vincent
jesse at bestpractical.com
Thu May 6 20:58:16 EDT 2004
Thanks. applied.
On Thu, May 06, 2004 at 06:07:39PM -0400, Marc Dougherty wrote:
> Attached is a patch that solves the problem with cookie handling in the
> RT CLI. I've tested the patch in both 3.0.10 and the 3.1 branch from
> subversion.
>
> According to Netscape's cookie specs, the only characters that are
> invalid in a cookie header are semicolon, comma, and whitespace.
>
> The patch also includes the two small fixes noted earlier by darren.
>
> comments welcome.
>
> --Marc.
>
> --
> Marc "Muncus" Dougherty
> Northeastern University
> College of Computer and Information Science
> Index: rt.in
> ===================================================================
> --- rt.in (revision 846)
> +++ rt.in (working copy)
> @@ -148,8 +148,9 @@
> my $title = $item->[2]{Title};
> my @titles = ref $title eq 'ARRAY' ? @$title : $title;
>
> - foreach $title (grep $_, @titles) {
> - $help{$title} = $item->[2]{Text};
> + foreach $title (grep $_, @titles) {
> + $help{$title} = $item->[2]{Text};
> + }
> }
> }
>
> @@ -234,7 +235,7 @@
> }
> return help("list", $type) if $bad;
>
> - my $r = submit("$REST/search/$type", { query => $q, %data, orderby => $orderby || "" });
> + my $r = submit("$REST/search/$type", { query => $q, %data, orderby => $data{orderby} || "" });
> print $r->content;
> }
>
> @@ -838,7 +839,7 @@
> sub cookie {
> my ($self) = @_;
> my $cookie = $self->{sids}{$s}{$u};
> - return defined $cookie ? "RT_SID=$cookie" : undef;
> + return defined $cookie ? "RT_SID_$cookie" : undef;
> }
>
> # Deletes the current session cookie.
> @@ -861,7 +862,7 @@
> my ($self, $response) = @_;
> my $cookie = $response->header("Set-Cookie");
>
> - if (defined $cookie && $cookie =~ /^RT_SID=([0-9A-Fa-f]+);/) {
> + if (defined $cookie && $cookie =~ /^RT_SID_(.[^;,\s]+=[0-9A-Fa-f]+);/) {
> $self->{sids}{$s}{$u} = $1;
> }
> }
> @@ -878,7 +879,7 @@
> while (<F>) {
> chomp;
> next if /^$/ || /^#/;
> - next unless m#^https?://[^ ]+ \w+ [0-9A-Fa-f]+$#;
> + next unless m#^https?://[^ ]+ \w+ [^;,\s]+=[0-9A-Fa-f]+$#;
> my ($server, $user, $cookie) = split / /, $_;
> $sids->{$server}{$user} = $cookie;
> }
> _______________________________________________
> Rt-devel mailing list
> Rt-devel at lists.bestpractical.com
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
--
More information about the Rt-devel
mailing list