X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=fde9681428adaf95eec30deea75c5ea599a82dfd;hb=ff2360486d5ce8aa0a9db80daec8c0c2a4b02fa7;hp=23ad038d629ae79f0e13e93ae5ae6dcc98e9167a;hpb=ccc9f8aa38cae2603b7111400ed6de24cdfcb419;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 23ad038..fde9681 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -16,6 +16,8 @@ use Path::Class; use Time::HiRes qw/gettimeofday tv_interval/; use URI; use Scalar::Util qw/weaken/; +use Hash::Util qw/lock_hash/; +use HTTP::Headers::ReadOnly; use attributes; __PACKAGE__->mk_accessors( @@ -54,7 +56,7 @@ __PACKAGE__->engine_class('Catalyst::Engine::CGI'); __PACKAGE__->request_class('Catalyst::Request'); __PACKAGE__->response_class('Catalyst::Response'); -our $VERSION = '5.51'; +our $VERSION = '5.52'; sub import { my ( $class, @arguments ) = @_; @@ -1023,7 +1025,11 @@ Finalizes cookies. =cut -sub finalize_cookies { my $c = shift; $c->engine->finalize_cookies( $c, @_ ) } +sub finalize_cookies { + my $c = shift; + $c->engine->finalize_cookies( $c, @_ ); + lock_hash( %$_ ) for $c->res->cookies, values %{ $c->res->cookies }; +} =item $c->finalize_error @@ -1066,6 +1072,8 @@ sub finalize_headers { $c->engine->finalize_headers( $c, @_ ); + bless $c->response->headers, "HTTP::Headers::ReadOnly"; + # Done $c->response->{_finalized_headers} = 1; } @@ -1774,6 +1782,9 @@ Writes $data to the output stream. When using this method directly, you will need to manually set the C header to the length of your output data, if known. +Also note that any headers created after the write can no longer be added, and +this includes cookies. + =cut sub write {