X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine.pm;h=a2cc178bb8361935fe6a833611346b14a8fd4a04;hb=f7a3f8fd0a1df1dc3f5811747cfa377a020b9dcc;hp=41c4b773d8ca5d1586e9b4660ce7821019e2de16;hpb=d2278086877372c00bcefc607a4713d0fded4d53;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 41c4b77..a2cc178 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -10,10 +10,15 @@ use HTML::Entities; use HTTP::Body; use HTTP::Headers; use URI::QueryParam; +use Moose::Util::TypeConstraints; +use Plack::Loader; +use Catalyst::EngineLoader; +use Encode (); +use utf8; use namespace::clean -except => 'meta'; -has env => (is => 'rw'); +has env => (is => 'ro', writer => '_set_env', clearer => '_clear_env'); # input position and length has read_length => (is => 'rw'); @@ -21,6 +26,20 @@ has read_position => (is => 'rw'); has _prepared_write => (is => 'rw'); +has _response_cb => ( + is => 'ro', + isa => 'CodeRef', + writer => '_set_response_cb', + clearer => '_clear_response_cb', +); + +has _writer => ( + is => 'ro', + isa => duck_type([qw(write close)]), + writer => '_set_writer', + clearer => '_clear_writer', +); + # Amount of data to read from input on each pass our $CHUNKSIZE = 64 * 1024; @@ -59,6 +78,12 @@ sub finalize_body { else { $self->write( $c, $body ); } + + $self->_writer->close; + $self->_clear_writer; + $self->_clear_env; + + return; } =head2 $self->finalize_cookies($c) @@ -131,6 +156,14 @@ sub finalize_error { $c->res->content_type('text/html; charset=utf-8'); my $name = ref($c)->config->{name} || join(' ', split('::', ref $c)); + + # Prevent Catalyst::Plugin::Unicode::Encoding from running. + # This is a little nasty, but it's the best way to be clean whether or + # not the user has an encoding plugin. + + if ($c->can('encoding')) { + $c->{encoding} = ''; + } my ( $title, $error, $infos ); if ( $c->debug ) { @@ -166,7 +199,6 @@ sub finalize_error { $error = ''; $infos = <<"";
-(es) Por favor inténtelo de nuevo más tarde (en) Please come back later (fr) SVP veuillez revenir plus tard (de) Bitte versuchen sie es spaeter nocheinmal @@ -280,11 +312,12 @@ sub finalize_error {