[Catalyst-commits] r7045 - trunk/Catalyst-Engine-HTTP-Sprocket/lib/Catalyst/Engine/HTTP/Sprocket

andyg at dev.catalyst.perl.org andyg at dev.catalyst.perl.org
Mon Oct 22 19:03:47 GMT 2007


Author: andyg
Date: 2007-10-22 19:03:46 +0100 (Mon, 22 Oct 2007)
New Revision: 7045

Modified:
   trunk/Catalyst-Engine-HTTP-Sprocket/lib/Catalyst/Engine/HTTP/Sprocket/Server.pm
Log:
Only check for CL once

Modified: trunk/Catalyst-Engine-HTTP-Sprocket/lib/Catalyst/Engine/HTTP/Sprocket/Server.pm
===================================================================
--- trunk/Catalyst-Engine-HTTP-Sprocket/lib/Catalyst/Engine/HTTP/Sprocket/Server.pm	2007-10-22 17:53:52 UTC (rev 7044)
+++ trunk/Catalyst-Engine-HTTP-Sprocket/lib/Catalyst/Engine/HTTP/Sprocket/Server.pm	2007-10-22 18:03:46 UTC (rev 7045)
@@ -217,13 +217,15 @@
     
     $con->send( $input );
     
-    if ( $input =~ /Content-Length:\s+(\d+)/i ) {
+    if ( !$con->x->{seen_length} && $input =~ /Content-Length:\s+(\d+)/i ) {
         # The header chunk, remember the body length
         $con->x->{length} = $1;
         $con->x->{sent}   = 0;
         
         DEBUG && warn "[$wheel_id] Starting response with length: " . $con->x->{length} . "\n";
         
+        $con->x->{seen_length} = 1;
+        
         # Any data in this chunk past \r\n\r\n is body data
         if ( $input =~ /\x0D\x0A\x0D\x0A(.+)/s ) {
             $con->x->{sent} = length $1;
@@ -244,6 +246,7 @@
         
         delete $con->x->{sent};
         delete $con->x->{length};
+        delete $con->x->{seen_length};
         
         # Push the HeadersOnly filter back on for the next request
         $con->filter->push(




More information about the Catalyst-commits mailing list