X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FEngine.pm;h=095c4ffe567372b332dc4618748101006d9fc5f6;hp=b5cba7bc343d215c0b17eca0bba63de43b6654e7;hb=74dafab798a163c251e09de7fcc21a267d1678a6;hpb=e0616220ee0bf2a2a9f0bacc0cb3b7fd2a464f36 diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index b5cba7b..095c4ff 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 ); + $self->write( $c, $buffer ); + } + $c->response->body->close(); + } + else { + $self->write( $c, $c->response->body ); + } } =item $self->finalize_cookies($c) @@ -341,10 +349,10 @@ sub prepare_query_parameters { $query_string =~ s/;/&/g; my $u = URI->new( '', 'http' ); - $u->query( $query_string ); - for my $key ( $u->query_param ) { - my @vals = $u->query_param($key); - $c->request->query_parameters->{$key} = @vals > 1 ? [@vals] : $vals[0]; + $u->query($query_string); + for my $key ( $u->query_param ) { + my @vals = $u->query_param($key); + $c->request->query_parameters->{$key} = @vals > 1 ? [@vals] : $vals[0]; } } @@ -386,11 +394,11 @@ sub prepare_uploads { push @uploads, $u; } $c->request->uploads->{$name} = @uploads > 1 ? \@uploads : $uploads[0]; - + # support access to the filename as a normal param my @filenames = map { $_->{filename} } @uploads; - $c->request->parameters->{$name} - = @filenames > 1 ? \@filenames : $filenames[0]; + $c->request->parameters->{$name} = + @filenames > 1 ? \@filenames : $filenames[0]; } }