Index: lib/Catalyst.pm =================================================================== --- lib/Catalyst.pm (revision 5943) +++ lib/Catalyst.pm (working copy) @@ -1386,9 +1386,11 @@ if ( $c->response->body && !$c->response->content_length ) { # get the length from a filehandle - if ( blessed( $c->response->body ) && $c->response->body->can('read') ) + my $body = $c->response->body; + if ( blessed( $body ) && $body->can('read') or ref($body) eq 'GLOB') { - if ( my $stat = stat $c->response->body ) { + my $stat = stat $body; + if ( $stat && $stat->size ) { $c->response->content_length( $stat->size ); } else { @@ -1396,7 +1398,7 @@ } } else { - $c->response->content_length( bytes::length( $c->response->body ) ); + $c->response->content_length( bytes::length( $body ) ); } }