This file documents the revision history for Perl extension Catalyst.
5.62
+ - Automatically determine Content-Length when serving a
+ filehandle.
- Exceptions now return status 500
- Updated for Module::Install 0.40
- Fixed additional file installation for multi level app names
use Catalyst::Request::Upload;
use Catalyst::Response;
use Catalyst::Utils;
+use File::stat;
use NEXT;
use Text::SimpleTable;
use Path::Class;
# Content-Length
if ( $c->response->body && !$c->response->content_length ) {
- $c->response->content_length( bytes::length( $c->response->body ) );
+ # 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' );
+ }
+ }
+ else {
+ $c->response->content_length(
+ bytes::length( $c->response->body ) );
+ }
}
# Errors