CC: | miyagawa [...] bulknews.net |
Hi Tatsuhiko,
unlike HTTP::Server::PSGI, Starman::Server fails to return the result of
transmission. Please find a patch attached to fix the issue.
This enables streaming code like:
sub handler {
my $responder = shift;
my $writer = $responder->([ 200, [ 'Content-Type', 'text/csv' ] ]);
while (check_conditions()) {
die($!) unless($writer->write("row of data\n"));
}
}
to work properly under Starman.
Subject: | Starman.diff |
diff -ru Starman.old/Server.pm /home/assa/local/lib/perl5/Starman/Server.pm
--- Starman.old/Server.pm 2012-10-05 23:55:30.000000000 -0400
+++ /home/assa/local/lib/perl5/Starman/Server.pm 2012-10-05 23:56:42.903160377 -0400
@@ -514,8 +514,9 @@
return unless $len;
$buffer = sprintf( "%x", $len ) . $CRLF . $buffer . $CRLF;
}
- syswrite $conn, $buffer;
+ my $ret = syswrite $conn, $buffer;
DEBUG && warn "[$$] Wrote " . length($buffer) . " bytes\n";
+ $ret;
},
close => sub {
syswrite $conn, "0$CRLF$CRLF" if $chunked;