[Catalyst-commits] r13595 - Catalyst-Runtime/5.80/branches/finalize_response/lib

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Tue Sep 14 21:38:04 GMT 2010


Author: t0m
Date: 2010-09-14 22:38:04 +0100 (Tue, 14 Sep 2010)
New Revision: 13595

Modified:
   Catalyst-Runtime/5.80/branches/finalize_response/lib/Catalyst.pm
Log:
Initial sketch

Modified: Catalyst-Runtime/5.80/branches/finalize_response/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/finalize_response/lib/Catalyst.pm	2010-09-14 21:31:58 UTC (rev 13594)
+++ Catalyst-Runtime/5.80/branches/finalize_response/lib/Catalyst.pm	2010-09-14 21:38:04 UTC (rev 13595)
@@ -1765,14 +1765,7 @@
             $c->finalize_error;
         }
 
-        $c->finalize_headers;
-
-        # HEAD request
-        if ( $c->request->method eq 'HEAD' ) {
-            $c->response->body('');
-        }
-
-        $c->finalize_body;
+        $c->finalize_response;
     }
 
     $c->log_response;
@@ -1786,7 +1779,29 @@
 
     return $c->response->status;
 }
+# 22:23 <@mst> sub finalize_response { $self->finalize_headers; $self->finalize_body; }
+# 22:27 <@mst> t0m: thoughts?
 
+# Thoughts: not sure about this, or what ::Encoding is doing.
+#           there are places where finalize_headers is being
+#           called otherwise (e.g. $c->write) and ::Encoding now hooks
+#           them (adding the headers to the blank body) when
+#           previously it won't have done. What's the right thing
+#           to do here?
+
+sub finalize_response {
+    my $c = shift;
+
+    $c->finalize_headers;
+
+    # HEAD request
+    if ( $c->request->method eq 'HEAD' ) {
+        $c->response->body('');
+    }
+
+    $c->finalize_body;
+}
+
 =head2 $c->finalize_body
 
 Finalizes body.




More information about the Catalyst-commits mailing list