[Catalyst-dev] Fwd: [rt.cpan.org #24134] [PATCH] Wrong
Content-Length when $c->res->body is a glob
Matt S Trout
dbix-class at trout.me.uk
Tue Jan 2 20:01:52 GMT 2007
Anybody had a look at this yet?
Begin forwarded message:
> From: " via RT" <bug-Catalyst-Runtime at rt.cpan.org>
> Date: 28 December 2006 19:07:31 GMT
> To: undisclosed-recipients:;
> Subject: [rt.cpan.org #24134] [PATCH] Wrong Content-Length when $c-
> >res->body is a glob
> Reply-To: bug-Catalyst-Runtime at rt.cpan.org
>
>
> Thu Dec 28 14:07:27 2006: Request 24134 was acted upon.
> Transaction: Ticket created by CDOLAN
> Queue: Catalyst-Runtime
> Subject: [PATCH] Wrong Content-Length when $c->res->body is a
> glob
> Broken in: 5.7005
> Severity: Normal
> Owner: Nobody
> Requestors: CDOLAN at cpan.org
> Status: new
> Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=24134 >
>
>
> If you set $c->res->body to a glob that is not tied to a file (e.g. a
> handle from IPC::Open3), then the Content-Length is set to the
> length of
> the length of the first chunk of data read from that handle. Instead,
> pipes like this should have indeterminate content length. The
> attached
> patch (against SVN rev 5943) corrects this issue, cribbing from
> Catalyst::Engine::finalize_body.
>
> With this patch, the example action below works. In my example, the
> @cmd is a variation on "make test".
>
> -- Chris
>
>
> use IPC::Open3 qw();
> sub test : Local {
> my ( $self, $c ) = @_;
>
> local %ENV = (
> PATH => $ENV{PATH},
> );
>
> my @cmd = get_cmd();
> my ($wtr, $rdr);
> my $pid = IPC::Open3::open3($wtr, $rdr, undef, @cmd);
> if (!$pid) {
> $c->res->status(500);
> $c->res->body('Failed to run tests');
> } else {
> close $wtr;
> $c->res->content_type('text/plain');
> $c->res->body($rdr);
>
> # TODO: figure out how to waitpid after finalize_body
> # and adjust CHUNKSIZE
> to something smaller than 4096
> #waitpid $pid, 0;
>
> }
> return;
> }
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: glob_body.patch
Type: application/octet-stream
Size: 975 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/catalyst-dev/attachments/20070102/d5092b05/glob_body.obj
-------------- next part --------------
--
Matt S Trout, Technical Director, Shadowcat Systems Ltd.
Offering custom development, consultancy and support contracts for
Catalyst,
DBIx::Class and BAST. Contact mst (at) shadowcatsystems.co.uk for
details.
+ Help us build a better perl ORM: http://dbix-
class.shadowcatsystems.co.uk/ +
More information about the Catalyst-dev
mailing list