Skip Menu |

This queue is for tickets about the Catalyst-Plugin-Compress-Zlib CPAN distribution.

Report information
The Basics
Id: 59032
Status: open
Priority: 0/
Queue: Catalyst-Plugin-Compress-Zlib

People
Owner: Nobody in particular
Requestors: abryan+bc [...] pangeamedia.com
Cc:
AdminCc:

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



Subject: Compress::Deflate fails when $c->response->body is a ref
I have attached a fix..It fails because even though it does this: my $body = $c->response->body; eval { local $/; $body = <$body> } if ref $body; It does not actually return $body, it still returns $c->response->body ( $out, $status ) = $d->deflate( $c->response->body ); I have attached a patch. Also, the Gzip plugin was setting an incorrect content length for this same reason. -- Andrew Bryan abryan+bc@pangeamedia.com
Subject: Catalyst-Plugin-Compress-Zlib.diff
diff -ru Catalyst-Plugin-Compress-Zlib-0.04.orig/lib/Catalyst/Plugin/Compress/Deflate.pm Catalyst-Plugin-Compress-Zlib-0.04/lib/Catalyst/Plugin/Compress/Deflate.pm --- Catalyst-Plugin-Compress-Zlib-0.04.orig/lib/Catalyst/Plugin/Compress/Deflate.pm 2009-11-19 20:22:49.000000000 -0500 +++ Catalyst-Plugin-Compress-Zlib-0.04/lib/Catalyst/Plugin/Compress/Deflate.pm 2010-07-01 15:45:06.738149038 -0400 @@ -43,7 +43,7 @@ my $body = $c->response->body; eval { local $/; $body = <$body> } if ref $body; die "Response body is an unsupported kind of reference" if ref $body; - ( $out, $status ) = $d->deflate( $c->response->body ); + ( $out, $status ) = $d->deflate( $body ); unless ( $status == Compress::Zlib::Z_OK() ) { die("Deflation failed. Error: $status"); diff -ru Catalyst-Plugin-Compress-Zlib-0.04.orig/lib/Catalyst/Plugin/Compress/Gzip.pm Catalyst-Plugin-Compress-Zlib-0.04/lib/Catalyst/Plugin/Compress/Gzip.pm --- Catalyst-Plugin-Compress-Zlib-0.04.orig/lib/Catalyst/Plugin/Compress/Gzip.pm 2009-11-19 20:22:42.000000000 -0500 +++ Catalyst-Plugin-Compress-Zlib-0.04/lib/Catalyst/Plugin/Compress/Gzip.pm 2010-07-01 15:45:37.792387158 -0400 @@ -35,7 +35,7 @@ die "Response body is an unsupported kind of reference" if ref $body; $c->response->body( Compress::Zlib::memGzip( $body ) ); - $c->response->content_length( length( $c->response->body ) ); + $c->response->content_length( length( $body ) ); $c->response->content_encoding('gzip'); $c->response->headers->push_header( 'Vary', 'Accept-Encoding' );
Whoops.. ignore the part about the Gzip response length... i should've looked more closely at that.. that part wasn't broken :S On Thu Jul 01 15:53:42 2010, abryan17 wrote: Show quoted text
> I have attached a fix..It fails because even though it does this: > > my $body = $c->response->body; > eval { local $/; $body = <$body> } if ref $body; > > It does not actually return $body, it still returns $c->response->body > > ( $out, $status ) = $d->deflate( $c->response->body ); > > I have attached a patch. Also, the Gzip plugin was setting an incorrect > content length for this same reason. >
-- -- Andrew Bryan abryan+bc@pangeamedia.com