From: John Napiorkowski Date: Thu, 29 Oct 2015 14:44:53 +0000 (-0500) Subject: Merge branch 'check_return_of_write_to_psgi_input' of https://github.com/billmoseley... X-Git-Tag: 5.90102~9^2~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=efc1a69b1e03a40bc721aa745846d45f855b9511;hp=d2995a765f120b78a134a6e8dfb14b0f7fde8644 Merge branch 'check_return_of_write_to_psgi_input' of https://github.com/billmoseley/catalyst-runtime into billmoseley-check_return_of_write_to_psgi_input --- diff --git a/lib/Catalyst/Request.pm b/lib/Catalyst/Request.pm index 3bcc6c2..1306b94 100644 --- a/lib/Catalyst/Request.pm +++ b/lib/Catalyst/Request.pm @@ -293,7 +293,10 @@ sub prepare_body { # Check for definedness as you could read '0' while ( defined ( my $chunk = $self->read() ) ) { $self->prepare_body_chunk($chunk); - $stream_buffer->print($chunk) if $stream_buffer; + next unless $stream_buffer; + + $stream_buffer->print($chunk) + || die sprintf "Failed to write %d bytes to psgi.input file: $!", length( $chunk ); } # Ok, we read the body. Lets play nice for any PSGI app down the pipe