X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine.pm;h=7f0a11b045ecceb30762d4c15beead3d162c3d03;hb=6f409682667c23a00552d0573c157ee3487c29bc;hp=b5cba7bc343d215c0b17eca0bba63de43b6654e7;hpb=e0616220ee0bf2a2a9f0bacc0cb3b7fd2a464f36;p=catagits%2FCatalyst-Runtime.git
diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm
index b5cba7b..7f0a11b 100644
--- a/lib/Catalyst/Engine.pm
+++ b/lib/Catalyst/Engine.pm
@@ -44,8 +44,16 @@ Finalize body. Prints the response output.
sub finalize_body {
my ( $self, $c ) = @_;
-
- $self->write( $c, $c->response->output );
+ if ( ref $c->response->body && $c->response->body->can('read') ) {
+ while ( !$c->response->body->eof() ) {
+ $c->response->body->read( my $buffer, $CHUNKSIZE );
+ last unless $self->write( $c, $buffer );
+ }
+ $c->response->body->close();
+ }
+ else {
+ $self->write( $c, $c->response->body );
+ }
}
=item $self->finalize_cookies($c)
@@ -70,8 +78,8 @@ sub finalize_cookies {
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 );
}
}
@@ -82,7 +90,7 @@ sub finalize_cookies {
sub finalize_error {
my ( $self, $c ) = @_;
- $c->res->headers->content_type('text/html');
+ $c->res->content_type('text/html; charset=utf-8');
my $name = $c->config->{name} || 'Catalyst Application';
my ( $title, $error, $infos );
@@ -91,10 +99,11 @@ sub finalize_error {
# For pretty dumps
local $Data::Dumper::Terse = 1;
$error = join '',
- map { '' . encode_entities($_) . '
' }
+ map { '
' . encode_entities($_) . '
$req-Response
$res-Stash
$stash+ my @infos; + my $i = 0; + for my $dump ( $c->dump_these ) { + my $name = $dump->[0]; + my $value = encode_entities( Dumper $dump->[1] ); + push @infos, sprintf <<"EOF", $name, $value; +
%s+