Merge branch 'master' into gsoc_breadboard
André Walker [Wed, 4 Jul 2012 18:14:32 +0000 (15:14 -0300)]
Changes
lib/Catalyst.pm
lib/Catalyst/Engine.pm
lib/Catalyst/Response.pm
lib/Catalyst/Runtime.pm
t/aggregate/live_component_controller_action_streaming.t
t/lib/TestApp.pm

diff --git a/Changes b/Changes
index 68a4626..02cb8cb 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,11 @@
 # This file documents the revision history for Perl extension Catalyst.
 
+5.90015 - 2012-06-30 16:57:00
+  - Fix $c->finalize_headers getting called twice. RT#78090
+  - Fix test fails in Catalyst-Plugin-Session-State-Cookie. RT#76179
+  - Fix test fails in Catalyst-Plugin-StackTrace
+  - Fix test fails in Test-WWW-Mechanize-Catalyst
+
 5.90014 - 2012-06-26 10:00:00
 
   - Fix calling finalize_headers before writing body when using $c->write /
index a3aa91d..73c97ef 100644 (file)
@@ -99,7 +99,7 @@ __PACKAGE__->stats_class('Catalyst::Stats');
 
 # Remember to update this in Catalyst::Runtime as well!
 
-our $VERSION = '5.90014';
+our $VERSION = '5.90015';
 
 sub import {
     my ( $class, @arguments ) = @_;
@@ -1636,7 +1636,7 @@ sub finalize {
             $c->finalize_error;
         }
 
-        $c->finalize_headers;
+        $c->finalize_headers unless $c->response->finalized_headers;
 
         # HEAD request
         if ( $c->request->method eq 'HEAD' ) {
@@ -1746,7 +1746,7 @@ EOF
 
     $c->finalize_cookies;
 
-    $c->engine->finalize_headers( $c, @_ );
+    $c->response->finalize_headers();
 
     # Done
     $response->finalized_headers(1);
index 4781e45..c414896 100644 (file)
@@ -331,7 +331,7 @@ Allows engines to write headers to response
 sub finalize_headers {
     my ($self, $ctx) = @_;
 
-    $ctx->response->finalize_headers;
+    $ctx->finalize_headers unless $ctx->response->finalized_headers;
     return;
 }
 
index eebe22c..6dc661e 100644 (file)
@@ -57,7 +57,7 @@ sub write {
     my ( $self, $buffer ) = @_;
 
     # Finalize headers if someone manually writes output
-    $self->_context->finalize_headers;
+    $self->_context->finalize_headers unless $self->finalized_headers;
 
     $buffer = q[] unless defined $buffer;
 
index f079d05..f786e0d 100644 (file)
@@ -7,7 +7,7 @@ BEGIN { require 5.008003; }
 
 # Remember to update this in Catalyst as well!
 
-our $VERSION = '5.90014';
+our $VERSION = '5.90015';
 
 =head1 NAME
 
index f6d93ee..ba18bd7 100644 (file)
@@ -30,6 +30,7 @@ sub run_tests {
         ok( $response->is_success, 'Response Successful 2xx' );
         is( $response->content_type, 'text/plain', 'Response Content-Type' );
         is( $response->header('X-Test-Header'), 'valid', 'Headers sent properly' );
+        is( $response->header('X-Test-Header-Call-Count'), 1);
 
         SKIP:
         {
@@ -69,6 +70,7 @@ EOF
         is( $response->content_type, 'text/plain', 'Response Content-Type' );
         is( $response->content_length, -s $file, 'Response Content-Length' );
         is( $response->header('X-Test-Header'), 'valid', 'Headers sent properly' );
+        is( $response->header('X-Test-Header-Call-Count'), 1);
         is( $response->content, $buffer, 'Content is read from filehandle' );
 
         ok( $response = request('http://localhost/action/streaming/body_glob'),
@@ -77,6 +79,7 @@ EOF
         is( $response->content_type, 'text/plain', 'Response Content-Type' );
         is( $response->content_length, -s $file, 'Response Content-Length' );
         is( $response->header('X-Test-Header'), 'valid', 'Headers sent properly' );
+        is( $response->header('X-Test-Header-Call-Count'), 1);
         is( $response->content, $buffer, 'Content is read from filehandle' );
     }
 
@@ -87,6 +90,7 @@ EOF
         ok( $response->is_success, 'Response Successful 2xx' );
         is( $response->content_type, 'text/plain', 'Response Content-Type' );
         is( $response->header('X-Test-Header'), 'valid', 'Headers sent properly' );
+        is( $response->header('X-Test-Header-Call-Count'), 1);
         is( $response->content_length, $size, 'Response Content-Length' );
         is( $response->content, "\0" x $size, 'Content is read from filehandle' );
     }
index 4b25a89..8baa786 100644 (file)
@@ -132,6 +132,11 @@ sub finalize_headers {
 
     $c->res->header('X-Test-Header', 'valid');
 
+    my $call_count = $c->stash->{finalize_headers_call_count} || 0;
+    $call_count++;
+    $c->stash(finalize_headers_call_count => $call_count);
+    $c->res->header('X-Test-Header-Call-Count' => $call_count);
+
     return $c->maybe::next::method(@_);
 }