Fixed streaming write from a filehandle to stop writing if the browser is closed
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine.pm
index 23df2a1..920fe0e 100644 (file)
@@ -47,7 +47,7 @@ sub finalize_body {
     if ( ref $c->response->body && $c->response->body->can('read') ) {
         while ( !$c->response->body->eof() ) {
             $c->response->body->read( my $buffer, $CHUNKSIZE );
-            $self->write( $c, $buffer );
+            last unless $self->write( $c, $buffer );
         }
         $c->response->body->close();
     }