From: Tomas Doran Date: Sun, 24 Jul 2011 16:03:32 +0000 (+0100) Subject: Merge master into psgi branch X-Git-Tag: 5.89003~25 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=ade50bdb79a80b82d1334aa987fe81c16740c0f6;hp=57ecbde4875bd0a04549c999224be9e7c50957bc Merge master into psgi branch --- diff --git a/Changes b/Changes index bfb09ae..7054c52 100644 --- a/Changes +++ b/Changes @@ -1,9 +1,41 @@ # This file documents the revision history for Perl extension Catalyst. +5.80033 2011-07-24 16:09:00 + Bug fixes: + - Fix Catalyst::Request so that the hostname accessor is not incorrectly + populated with 'localhost' if a reverse DNS lookup fails. + + - Fix Path actions debug screen to display number of arguments + + - Fix a regression that prevented configuring attributes for all actions using + ->config(actions => { '*' => \%attrs }) from working + + - Append $\ in Catalyst::Response->print to more closely match + IO::Handle's behaviour. + + - Fixed situation where a detach($action) from a forward within auto + was not breaking out correctly + - Fix the disable_component_resolution_regex_fallback config setting to also work in the $c->component method. + - Handle users setting cookies with an undef value by not trying to + output that cookie (rather than trying to do so and causing an exception + as previously happened). A warning is logged if this occurs in debug + mode. + - Update tests to ignore $ENV{CATALYST_HOME} where required + + - Change repository metadata to point at git. + + - Clean namespaces in Catalyst::Request::Upload + + - Catalyst::Test: Fixes to action_ok, action_redirect and action_notfound + test functions to be better documented, and have better default test + names. + + - Update tests to ignore CATALYST_HOME env var. + 5.89002 2011-03-02 11:30:00 (TRIAL release) Bug fixes: diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 84c75e9..b34ceec 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -128,6 +128,11 @@ sub finalize_cookies { -httponly => $val->{httponly} || 0, ) ); + if (!defined $cookie) { + $c->log->warn("undef passed in '$name' cookie value - not setting cookie") + if $c->debug; + next; + } push @cookies, $cookie->as_string; } diff --git a/lib/Catalyst/Runtime.pm b/lib/Catalyst/Runtime.pm index 0613feb..fc8c555 100644 --- a/lib/Catalyst/Runtime.pm +++ b/lib/Catalyst/Runtime.pm @@ -7,7 +7,7 @@ BEGIN { require 5.008004; } # Remember to update this in Catalyst as well! -our $VERSION = '5.89002'; +our $VERSION = '5.80033'; =head1 NAME diff --git a/t/aggregate/live_component_controller_action_auto.t b/t/aggregate/live_component_controller_action_auto.t index 01bdfe4..853bb8f 100644 --- a/t/aggregate/live_component_controller_action_auto.t +++ b/t/aggregate/live_component_controller_action_auto.t @@ -10,13 +10,13 @@ our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } -use Test::More tests => 27*$iters; +use Test::More; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { require Benchmark; Benchmark::timethis( $iters, \&run_tests ); - + # new dispatcher: # 11 wallclock secs (10.14 usr + 0.20 sys = 10.34 CPU) @ 15.18/s (n=157) # old dispatcher (r1486): @@ -27,7 +27,7 @@ else { run_tests(); } } - + sub run_tests { # test auto + local method { @@ -37,15 +37,15 @@ sub run_tests { TestApp::Controller::Action::Auto->one TestApp::Controller::Root->end ]; - + my $expected = join( ", ", @expected ); - + ok( my $response = request('http://localhost/action/auto/one'), 'auto + local' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, 'one', 'Content OK' ); } - + # test auto + default { my @expected = qw[ @@ -54,15 +54,15 @@ sub run_tests { TestApp::Controller::Action::Auto->default TestApp::Controller::Root->end ]; - + my $expected = join( ", ", @expected ); - + ok( my $response = request('http://localhost/action/auto/anything'), 'auto + default' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, 'default', 'Content OK' ); } - + # test auto + auto + local { my @expected = qw[ @@ -72,15 +72,15 @@ sub run_tests { TestApp::Controller::Action::Auto::Deep->one TestApp::Controller::Root->end ]; - + my $expected = join( ", ", @expected ); - + ok( my $response = request('http://localhost/action/auto/deep/one'), 'auto + auto + local' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, 'deep one', 'Content OK' ); } - + # test auto + auto + default { my @expected = qw[ @@ -90,15 +90,15 @@ sub run_tests { TestApp::Controller::Action::Auto::Deep->default TestApp::Controller::Root->end ]; - + my $expected = join( ", ", @expected ); - + ok( my $response = request('http://localhost/action/auto/deep/anything'), 'auto + auto + default' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, 'deep default', 'Content OK' ); } - + # test auto + failing auto + local + end { my @expected = qw[ @@ -107,15 +107,15 @@ sub run_tests { TestApp::Controller::Action::Auto::Abort->auto TestApp::Controller::Action::Auto::Abort->end ]; - + my $expected = join( ", ", @expected ); - + ok( my $response = request('http://localhost/action/auto/abort/one'), 'auto + failing auto + local' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, 'abort end', 'Content OK' ); } - + # test auto + default (bug on invocation of default twice) { my @expected = qw[ @@ -125,9 +125,9 @@ sub run_tests { TestApp::Controller::Action::Auto::Default->default TestApp::Controller::Action::Auto::Default->end ]; - + my $expected = join( ", ", @expected ); - + ok( my $response = request('http://localhost/action/auto/default/moose'), 'auto + default' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); @@ -142,9 +142,9 @@ sub run_tests { TestApp::Controller::Action::Auto::Detach->auto TestApp::Controller::Root->end ]; - + my $expected = join( ", ", @expected ); - + ok( my $response = request('http://localhost/action/auto/detach'), 'auto with detach' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); @@ -160,9 +160,9 @@ sub run_tests { TestApp::Controller::Action::Auto::Detach->with_forward_detach TestApp::Controller::Root->end ]; - + my $expected = join( ", ", @expected ); - + ok( my $response = request('http://localhost/action/auto/detach?with_forward_detach=1'), 'auto with_forward_detach' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); @@ -179,12 +179,15 @@ sub run_tests { TestApp::Controller::Action::Auto::Detach->detach_action TestApp::Controller::Root->end ]; - + my $expected = join( ", ", @expected ); - + ok( my $response = request('http://localhost/action/auto/detach?with_forward_detach=1&detach_to_action=1'), 'auto with_forward_detach to detach_action' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); is( $response->content, 'detach_action', 'Content OK' ); } } + +done_testing; + diff --git a/t/aggregate/live_engine_response_cookies.t b/t/aggregate/live_engine_response_cookies.t index 5f2f226..3bb3533 100644 --- a/t/aggregate/live_engine_response_cookies.t +++ b/t/aggregate/live_engine_response_cookies.t @@ -6,7 +6,7 @@ use warnings; use FindBin; use lib "$FindBin::Bin/../lib"; -use Test::More tests => 15; +use Test::More; use Catalyst::Test 'TestApp'; use HTTP::Headers::Util 'split_header_words'; @@ -71,3 +71,27 @@ my $expected = { this_is_the_real_name => [ qw(this_is_the_real_name foo&bar path /) ], # not "object" }, 'Response Cookies' ); } + +{ + my $response; + ok( $response = request('http://localhost/engine/response/cookies/four'), + 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ) or diag explain $response; + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + is( $response->header('X-Catalyst-Action'), + 'engine/response/cookies/four', 'Test Action' ); + + my $cookies = {}; + + for my $string ( $response->header('Set-Cookie') ) { + my $cookie = [ split_header_words $string]; + $cookies->{ $cookie->[0]->[0] } = $cookie->[0]; + } + + is_deeply( $cookies, { + good => [qw|good good_cookie path /|], + }, 'Response Cookies' ); +} + +done_testing; + diff --git a/t/aggregate/unit_core_path_to.t b/t/aggregate/unit_core_path_to.t index f4fe89f..823e626 100644 --- a/t/aggregate/unit_core_path_to.t +++ b/t/aggregate/unit_core_path_to.t @@ -27,6 +27,8 @@ use_ok('Catalyst'); my $context = 'Catalyst'; +delete $ENV{CATALYST_HOME}; # otherwise it'll set itself up to the wrong place + $context->setup_home; my $base = dir($FindBin::Bin)->relative->stringify; diff --git a/t/aggregate/utf8_content_length.t b/t/aggregate/utf8_content_length.t index 86297e8..64d4eb8 100644 --- a/t/aggregate/utf8_content_length.t +++ b/t/aggregate/utf8_content_length.t @@ -5,6 +5,8 @@ use lib "$Bin/../lib"; use File::Spec; use Test::More; +BEGIN { delete $ENV{CATALYST_HOME} } + use Catalyst::Test qw/TestAppEncoding/; if ( $ENV{CATALYST_SERVER} ) { diff --git a/t/lib/TestApp/Controller/Engine/Response/Cookies.pm b/t/lib/TestApp/Controller/Engine/Response/Cookies.pm index 320c2e1..884b326 100644 --- a/t/lib/TestApp/Controller/Engine/Response/Cookies.pm +++ b/t/lib/TestApp/Controller/Engine/Response/Cookies.pm @@ -32,4 +32,11 @@ sub three : Local { $c->forward('TestApp::View::Dump::Request'); } +sub four : Local { + my ( $self, $c ) = @_; + $c->res->cookies->{good} = { value => 'good_cookie', path => '/' }; + $c->res->cookies->{bad} = { value => undef }; + $c->forward('TestApp::View::Dump::Request'); +} + 1; diff --git a/t/live_catalyst_test.t b/t/live_catalyst_test.t index 8831fe7..9fb299f 100644 --- a/t/live_catalyst_test.t +++ b/t/live_catalyst_test.t @@ -6,7 +6,7 @@ use lib "$FindBin::Bin/lib"; use Catalyst::Test 'TestApp', {default_host => 'default.com'}; use Catalyst::Request; -use Test::More tests => 10; +use Test::More; content_like('/',qr/root/,'content check'); action_ok('/','Action ok ok','normal action ok'); @@ -43,3 +43,6 @@ my $req = '/dump/request'; eval '$creq = ' . request($req, \%opts)->content; is( $creq->uri->host, $opts{host}, 'target host is mutable via options hashref' ); } + +done_testing; +