[Catalyst-commits] r11139 - Catalyst-Runtime/5.80/trunk/lib/Catalyst

rafl at dev.catalyst.perl.org rafl at dev.catalyst.perl.org
Sun Aug 16 09:19:58 GMT 2009


Author: rafl
Date: 2009-08-16 09:19:58 +0000 (Sun, 16 Aug 2009)
New Revision: 11139

Modified:
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine.pm
Log:
Do at least one (possibly empty) write when reading the response body from a filehandle.

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine.pm	2009-08-16 08:59:54 UTC (rev 11138)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine.pm	2009-08-16 09:19:58 UTC (rev 11139)
@@ -48,10 +48,12 @@
     my $body = $c->response->body;
     no warnings 'uninitialized';
     if ( blessed($body) && $body->can('read') or ref($body) eq 'GLOB' ) {
-        while ( !eof $body ) {
+        my $got;
+        do {
             read $body, my ($buffer), $CHUNKSIZE;
             last unless $self->write( $c, $buffer );
-        }
+        } while $got > 0;
+
         close $body;
     }
     else {




More information about the Catalyst-commits mailing list