This file documents the revision history for Perl extension Catalyst.
+5.55 2005-11-15 12:55:00
+ - Fixed multiple cookie handling
+
5.54 2005-11-14 22:55:00
- Fixed a Module::Pluggable::Fast related bug
__PACKAGE__->request_class('Catalyst::Request');
__PACKAGE__->response_class('Catalyst::Response');
-our $VERSION = '5.54';
+our $VERSION = '5.55';
sub import {
my ( $class, @arguments ) = @_;
push @cookies, $cookie->as_string;
}
- if (@cookies) {
- $c->res->headers->push_header( 'Set-Cookie' => join ',', @cookies );
+ for my $cookie (@cookies) {
+ $c->res->headers->push_header( 'Set-Cookie' => $cookie );
}
}
use strict;
use base 'Catalyst::Engine::CGI';
use Catalyst::Utils;
+use HTTP::Headers;
use HTTP::Response;
use HTTP::Status;
use NEXT;
# We emulate CGI
local %ENV = (
- PATH_INFO => $request->uri->path || '',
- QUERY_STRING => $request->uri->query || '',
- REMOTE_ADDR => '127.0.0.1',
- REMOTE_HOST => 'localhost',
+ PATH_INFO => $request->uri->path || '',
+ QUERY_STRING => $request->uri->query || '',
+ REMOTE_ADDR => '127.0.0.1',
+ REMOTE_HOST => 'localhost',
REQUEST_METHOD => $request->method,
SERVER_NAME => 'localhost',
SERVER_PORT => $request->uri->port,
package Catalyst::Test;
use strict;
+use warnings;
use Catalyst::Exception;
use Catalyst::Utils;
use UNIVERSAL::require;
+use HTTP::Headers;
$ENV{CATALYST_ENGINE} = 'Test';
+# Bypass a HTTP::Headers bug
+{
+ no warnings 'redefine';
+
+ sub HTTP::Headers::new {
+ my $class = shift;
+ my $self = bless {}, $class;
+ if (@_) {
+ while ( my ( $field, $val ) = splice( @_, 0, 2 ) ) {
+ $self->push_header( $field, $val );
+ }
+ }
+ return $self;
+ }
+}
+
=head1 NAME
Catalyst::Test - Test Catalyst applications
use Test::More tests => 10;
use Catalyst::Test 'TestApp';
-
use HTTP::Headers::Util 'split_header_words';
my $expected = {
- Catalyst => [qw( Catalyst Cool path / )],
- Cool => [qw( Cool Catalyst path / )]
+ Catalyst => [qw|Catalyst Cool path /|],
+ Cool => [qw|Cool Catalyst path /|]
};
{
my $cookies = {};
- for my $cookie ( split_header_words( $response->header('Set-Cookie') ) ) {
- $cookies->{ $cookie->[0] } = $cookie;
+ for my $string ( $response->header('Set-Cookie') ) {
+ my $cookie = [ split_header_words $string];
+ $cookies->{ $cookie->[0]->[0] } = $cookie->[0];
}
is_deeply( $cookies, $expected, 'Response Cookies' );
my $cookies = {};
- for my $cookie ( split_header_words( $response->header('Set-Cookie') ) ) {
- $cookies->{ $cookie->[0] } = $cookie;
+ for my $string ( $response->header('Set-Cookie') ) {
+ my $cookie = [ split_header_words $string];
+ $cookies->{ $cookie->[0]->[0] } = $cookie->[0];
}
is_deeply( $cookies, $expected, 'Response Cookies' );