From: John Napiorkowski Date: Tue, 21 Jan 2014 23:45:55 +0000 (-0600) Subject: new middleware X-Git-Tag: 5.90060~25 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=ecf903d0523a9a927684d6f9dc125f8d27bf2f6f;hp=9ae060f08b6948a1d89eef14fff9d78e6a435d29 new middleware --- diff --git a/Makefile.PL b/Makefile.PL index 3d06b69..01ea024 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -75,6 +75,14 @@ requires 'Stream::Buffered'; requires 'Hash::MultiValue'; requires 'Plack::Request::Upload'; requires 'CGI::Struct'; +requires "Plack::Middleware::Conditional"; +requires "Plack::Middleware::IIS6ScriptNameFix"; +requires "Plack::Middleware::IIS7KeepAliveFix"; +requires "Plack::Middleware::LighttpdScriptNameFix"; +requires "Plack::Middleware::ContentLength"; +requires "Plack::Middleware::Head"; +requires "Plack::Middleware::HTTPExceptions"; +requires "Plack::Middleware::FixMissingBodyInRedirect"; test_requires 'Test::Fatal'; test_requires 'Test::More' => '0.88'; diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 39d513d..499e49a 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -44,6 +44,7 @@ use Plack::Middleware::LighttpdScriptNameFix; use Plack::Middleware::ContentLength; use Plack::Middleware::Head; use Plack::Middleware::HTTPExceptions; +use Plack::Middleware::FixMissingBodyInRedirect; use Plack::Util; use Class::Load 'load_class'; @@ -1935,23 +1936,6 @@ sub finalize_headers { if ( my $location = $response->redirect ) { $c->log->debug(qq/Redirecting to "$location"/) if $c->debug; $response->header( Location => $location ); - - if ( !$response->has_body ) { - # Add a default body if none is already present - my $encoded_location = encode_entities($location); - $response->body(<<"EOF"); - - - - Moved - - -

This item has moved here.

- - -EOF - $response->content_type('text/html; charset=utf-8'); - } } # Remove incorrectly added body and content related meta data when returning @@ -3128,6 +3112,7 @@ sub registered_middlewares { if(my $middleware = $class->_psgi_middleware) { return ( Plack::Middleware::HTTPExceptions->new, + Plack::Middleware::FixMissingBodyInRedirect->new, Plack::Middleware::ContentLength->new, Plack::Middleware::Head->new, @$middleware); @@ -3951,6 +3936,8 @@ rainboxx: Matthias Dietrich, C dd070: Dhaval Dhanani +Upasana + =head1 COPYRIGHT Copyright (c) 2005, the above named PROJECT FOUNDER and CONTRIBUTORS.