X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine.pm;h=b34ceecdb94aa40c022ca50f7fe1c5c861704fcf;hb=be5cf2d55e39edd87d8ef84d2fc534e38699642c;hp=7cba9dd967f2031de52d1ef2d55d3c658b8e83ab;hpb=0c6352ff331d7d1c43931d24e1fd8efb21b6d902;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 7cba9dd..b34ceec 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -42,6 +42,7 @@ has _response_cb => ( isa => 'CodeRef', writer => '_set_response_cb', clearer => '_clear_response_cb', + predicate => '_has_response_cb', ); has _writer => ( @@ -127,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; } @@ -342,6 +348,15 @@ Abstract method, allows engines to write headers to response sub finalize_headers { my ($self, $ctx) = @_; + # This is a less-than-pretty hack to avoid breaking the old + # Catalyst::Engine::PSGI. 5.9 Catalyst::Engine sets a response_cb and + # expects us to pass headers to it here, whereas Catalyst::Enngine::PSGI + # just pulls the headers out of $ctx->response in its run method and never + # sets response_cb. So take the lack of a response_cb as a sign that we + # don't need to set the headers. + + return unless $self->_has_response_cb; + my @headers; $ctx->response->headers->scan(sub { push @headers, @_ });