Skip to content
Browse files

Avoid CPU spin on unexpected EOF

  • Loading branch information...
1 parent 6b2cc12 commit 472492c2f89ca9b3001c325a54d69c6fbf60a917 @gbarr gbarr committed
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/Starman/Server.pm
View
5 lib/Starman/Server.pm
@@ -335,6 +335,11 @@ sub _prepare_env {
my $buf = Plack::TempBuffer->new($cl);
while ($cl > 0) {
my($chunk, $read) = $get_chunk->();
+
+ if ( !defined $read || $read == 0 ) {
+ die "Read error: $!\n";
+ }
+
$cl -= $read;
$buf->print($chunk);
}

0 comments on commit 472492c

Please sign in to comment.
Something went wrong with that request. Please try again.