Fixed bug in HTTP engine where writes could fail with 'Resource temporarily unavailable'
Andy Grundman [Wed, 22 Aug 2007 16:32:49 +0000 (16:32 +0000)]
Changes
lib/Catalyst.pm
lib/Catalyst/Engine.pm
lib/Catalyst/Runtime.pm

diff --git a/Changes b/Changes
index 7912807..76d7dac 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
 e This file documents the revision history for Perl extension Catalyst.
 
+5.7011
+        - Fixed bug in HTTP engine where writes could fail with
+          'Resource temporarily unavailable'.
+
 5.7010  2007-08-22 07:41:00
         - Resource forks in 5.7009
 
index 09ef82a..06bcf09 100644 (file)
@@ -63,7 +63,7 @@ __PACKAGE__->response_class('Catalyst::Response');
 
 # Remember to update this in Catalyst::Runtime as well!
 
-our $VERSION = '5.7010';
+our $VERSION = '5.7011';
 
 sub import {
     my ( $class, @arguments ) = @_;
index 347f781..c53bc12 100644 (file)
@@ -625,6 +625,11 @@ sub write {
     my $len   = length($buffer);
     my $wrote = syswrite STDOUT, $buffer;
     
+    if ( !defined $wrote && $! == EWOULDBLOCK ) {
+        # Unable to write on the first try, will retry in the loop below
+        $wrote = 0;
+    }
+    
     if ( defined $wrote && $wrote < $len ) {
         # We didn't write the whole buffer
         while (1) {
index e04ed9e..73d7079 100644 (file)
@@ -7,7 +7,7 @@ BEGIN { require 5.008001; }
 
 # Remember to update this in Catalyst as well!
 
-our $VERSION='5.7010';
+our $VERSION='5.7011';
 
 =head1 NAME