Skip Menu |

This queue is for tickets about the HTML-Mason CPAN distribution.

Report information
The Basics
Id: 33710
Status: resolved
Priority: 0/
Queue: HTML-Mason

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

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



Subject: CGIHandler does not handles multiple cookies
When multiple cookies are set via $r->http_headers->add('Set-Cookie' => $cookie), the result is "Set-cookie: ARRAY(0x012345)"
Subject: HTML-Mason.diff
Index: t/14a-fake_apache.t =================================================================== --- t/14a-fake_apache.t (revision 3880) +++ t/14a-fake_apache.t (working copy) @@ -1,7 +1,7 @@ #!perl -w use strict; -use Test::More tests => 92; +use Test::More tests => 96; use CGI qw(-no_debug); BEGIN { use_ok('HTML::Mason::CGIHandler') } @@ -118,6 +118,10 @@ is( $r->header_out('Annoyance-Level'), undef, "Check annoyance level again" ); is( $h->{'annoyance-level'}, undef, "Check the hash directly again" ); +# Add some cookies +ok( $r->headers_out()->add('Set-Cookie' => 'AF_SID=6e8834d8787ee57a; path=/'), "Set cookie" ); +ok( $r->headers_out()->add('Set-Cookie' => 'uniq_id=5608074; path=/; expires=Tue, 26-Aug-2008 21:27:03 GMT'), "Set cookie" ); + # Now check err_headers_out. my $url = 'http://example.com/'; ok( my $e = $r->err_headers_out, "Get error headers out" ); @@ -183,6 +187,8 @@ like($headers, qr|Location: $url|i, "Check location" ); like($headers, qr|Content-Type: text/xml(?:; charset=ISO-8859-1)?|i, "Check content type" ); +like($headers, qr|Set-Cookie: AF_SID=6e8834d8787ee57a; path=/|i, "Check cookie 1"); +like($headers, qr|Set-Cookie: uniq_id=5608074; path=/; expires=Tue, 26-Aug-2008 21:27:03 GMT|i, "Check cookie 2"); is( $r->uri, '/login/welcome.html/index.html', 'test uri method' ); is( $r->path_info, '/index.html', 'test path_info method' ); Index: lib/HTML/Mason/FakeApache.pm =================================================================== --- lib/HTML/Mason/FakeApache.pm (revision 3880) +++ lib/HTML/Mason/FakeApache.pm (working copy) @@ -458,9 +458,15 @@ sub cgi_headers { my $self = shift; - map { $_ => $self->{$_}[1] } keys %$self; + map { _map_header_key_to_cgi_key($_) => $self->{$_}[1] } keys %$self; } +sub _map_header_key_to_cgi_key +{ + my ($header) = @_; + return $header eq '-set-cookie' ? '-cookies' : $header; +} + 1; __END__