Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Starman CPAN distribution.

Report information
The Basics
Id: 80032
Status: open
Priority: 0/
Queue: Starman

People
Owner: Nobody in particular
Requestors: ACCA [...] cpan.org
Cc: miyagawa [...] bulknews.net
AdminCc:

Bug Information
Severity: Important
Broken in: 0.3003
Fixed in: (no value)



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;
Subject: Re: [rt.cpan.org #80032]
Date: Fri, 5 Oct 2012 21:42:32 -0700
To: "bug-Starman [...] rt.cpan.org" <bug-Starman [...] rt.cpan.org>
From: Tatsuhiko Miyagawa <miyagawa [...] gmail.com>
Can you make a pull request on github instead. Thanks Sent from my iPhone On Oct 5, 2012, at 9:34 PM, Alexander Kuznetsov via RT <bug-Starman@rt.cpan.org> wrote: Show quoted text
> Sat Oct 06 00:34:09 2012: Request 80032 was acted upon. > Transaction: Ticket created by ACCA > Queue: Starman > Subject: (No subject given) > Broken in: 0.3003 > Severity: Important > Owner: Nobody > Requestors: ACCA@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=80032 > > > > 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. > > 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;
Subject: [PATCH] Return proper value for transmission result for streaming interface ->write();
RT-Send-CC: miyagawa [...] gmail.com
The same with git format-patch
Subject: 0001-Return-proper-value-for-transmission-result-for-stre.patch
diff --git a/lib/Starman/Server.pm b/lib/Starman/Server.pm index b5bb579..8d6f518 100644 --- a/lib/Starman/Server.pm +++ b/lib/Starman/Server.pm @@ -514,8 +514,9 @@ sub _finalize_response { 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;