X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=fa7ca6ae714f311e92bb1c9c6d0beeab0d2b9b50;hp=dc56b884a0d5de88ab054471ffe0f02eb91600e6;hb=d7d72ad91cc796713d84c256e08ef9b1a6473542;hpb=8f62c91addd1c43b8639b2a11b0eb007d9834f46 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index dc56b88..fa7ca6a 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -44,7 +44,7 @@ our $DETACH = "catalyst_detach\n"; require Module::Pluggable::Fast; # Helper script generation -our $CATALYST_SCRIPT_GEN = 24; +our $CATALYST_SCRIPT_GEN = 25; __PACKAGE__->mk_classdata($_) for qw/components arguments dispatcher engine log dispatcher_class @@ -1016,19 +1016,18 @@ sub finalize_headers { # Content-Length if ( $c->response->body && !$c->response->content_length ) { + # get the length from a filehandle if ( ref $c->response->body && $c->response->body->can('read') ) { if ( my $stat = stat $c->response->body ) { $c->response->content_length( $stat->size ); } else { - $c->log->warn( - 'Serving filehandle without a content-length' ); + $c->log->warn('Serving filehandle without a content-length'); } } else { - $c->response->content_length( - bytes::length( $c->response->body ) ); + $c->response->content_length( bytes::length( $c->response->body ) ); } }