my $n = 8192;
while ($len > 0) {
$n = $len if $len < $n;
- my $r = read($in, $buf, $n);
+ my $r = sysread($in, $buf, $n);
last if (!defined($r) || $r <= 0);
$len -= $r;
$fh->write($buf);
if (my $async = $env->{'pi-httpd.async'}) {
$rpipe = $async->($rpipe, $cb);
sub { ($res) = @_ } # let Danga::Socket handle the rest.
- } else { # synchronous loop
+ } else { # synchronous loop for other PSGI servers
$vin = '';
vec($vin, fileno($rpipe), 1) = 1;
sub {