X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=0b2c012e86790881ad42245eaf47f0066230a7a9;hb=760d121ecfcc1ad7c28342a6912a472fe30e5fe0;hp=ea5507d7be1ef17d86751d9e5056ca113ed64065;hpb=f0580bff341c3d9a8a62bb8e670ff8772745786f;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index ea5507d..0b2c012 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -23,6 +23,7 @@ use Path::Class::File (); use URI (); use URI::http; use URI::https; +use HTML::Entities; use Tree::Simple qw/use_weak_refs/; use Tree::Simple::Visitor::FindByUID; use Class::C3::Adopt::NEXT; @@ -52,20 +53,30 @@ has request => ( is => 'rw', default => sub { my $self = shift; - my %p = ( _log => $self->log ); - $p{_uploadtmp} = $self->_uploadtmp if $self->_has_uploadtmp; - $self->request_class->new(\%p); + $self->request_class->new($self->_build_request_constructor_args); }, lazy => 1, ); +sub _build_request_constructor_args { + my $self = shift; + my %p = ( _log => $self->log ); + $p{_uploadtmp} = $self->_uploadtmp if $self->_has_uploadtmp; + \%p; +} + has response => ( is => 'rw', default => sub { my $self = shift; - $self->response_class->new({ _log => $self->log }); + $self->response_class->new($self->_build_response_constructor_args); }, lazy => 1, ); +sub _build_response_constructor_args { + my $self = shift; + { _log => $self->log }; +} + has namespace => (is => 'rw'); sub depth { scalar @{ shift->stack || [] }; } @@ -102,7 +113,7 @@ __PACKAGE__->stats_class('Catalyst::Stats'); # Remember to update this in Catalyst::Runtime as well! -our $VERSION = '5.90016'; +our $VERSION = '5.90019'; sub import { my ( $class, @arguments ) = @_; @@ -1859,6 +1870,7 @@ sub finalize_headers { if ( !$response->has_body ) { # Add a default body if none is already present + my $encoded_location = encode_entities($location); $response->body(<<"EOF"); @@ -1866,7 +1878,7 @@ sub finalize_headers { Moved -

This item has moved here.

+

This item has moved here.

EOF