[Catalyst-commits] r6594 - in trunk/Catalyst-Plugin-Compress-Zlib:
. lib/Catalyst/Plugin/Compress
marcus at dev.catalyst.perl.org
marcus at dev.catalyst.perl.org
Fri Jul 27 18:00:12 GMT 2007
Author: marcus
Date: 2007-07-27 18:00:11 +0100 (Fri, 27 Jul 2007)
New Revision: 6594
Modified:
trunk/Catalyst-Plugin-Compress-Zlib/Changes
trunk/Catalyst-Plugin-Compress-Zlib/lib/Catalyst/Plugin/Compress/Deflate.pm
trunk/Catalyst-Plugin-Compress-Zlib/lib/Catalyst/Plugin/Compress/Gzip.pm
trunk/Catalyst-Plugin-Compress-Zlib/lib/Catalyst/Plugin/Compress/Zlib.pm
Log:
Support FH response body
Modified: trunk/Catalyst-Plugin-Compress-Zlib/Changes
===================================================================
--- trunk/Catalyst-Plugin-Compress-Zlib/Changes 2007-07-25 03:04:05 UTC (rev 6593)
+++ trunk/Catalyst-Plugin-Compress-Zlib/Changes 2007-07-27 17:00:11 UTC (rev 6594)
@@ -1,8 +1,11 @@
Revision history for Perl extension Catalyst::Plugin::Compress::Zlib
+0.03 2007-07-27 18:22
+ - Add support for FH body.
+
0.02 2007-04-29 02:25
- Compress Content-Type that matches /^text|xml$|javascript$/
- - Switch to Module::Install
+ - Switch to Module::Install
0.01 Wed Apr 28 01:00:00 2005
- original version.
Modified: trunk/Catalyst-Plugin-Compress-Zlib/lib/Catalyst/Plugin/Compress/Deflate.pm
===================================================================
--- trunk/Catalyst-Plugin-Compress-Zlib/lib/Catalyst/Plugin/Compress/Deflate.pm 2007-07-25 03:04:05 UTC (rev 6593)
+++ trunk/Catalyst-Plugin-Compress-Zlib/lib/Catalyst/Plugin/Compress/Deflate.pm 2007-07-27 17:00:11 UTC (rev 6594)
@@ -39,6 +39,9 @@
die("Cannot create a deflation stream. Error: $status");
}
+ 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 );
unless ( $status == Compress::Zlib::Z_OK() ) {
Modified: trunk/Catalyst-Plugin-Compress-Zlib/lib/Catalyst/Plugin/Compress/Gzip.pm
===================================================================
--- trunk/Catalyst-Plugin-Compress-Zlib/lib/Catalyst/Plugin/Compress/Gzip.pm 2007-07-25 03:04:05 UTC (rev 6593)
+++ trunk/Catalyst-Plugin-Compress-Zlib/lib/Catalyst/Plugin/Compress/Gzip.pm 2007-07-27 17:00:11 UTC (rev 6594)
@@ -29,7 +29,11 @@
return $c->NEXT::finalize;
}
- $c->response->body( Compress::Zlib::memGzip( $c->response->body ) );
+ my $body = $c->response->body;
+ eval { local $/; $body = <$body> } if ref $body;
+ 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_encoding('gzip');
$c->response->headers->push_header( 'Vary', 'Accept-Encoding' );
Modified: trunk/Catalyst-Plugin-Compress-Zlib/lib/Catalyst/Plugin/Compress/Zlib.pm
===================================================================
--- trunk/Catalyst-Plugin-Compress-Zlib/lib/Catalyst/Plugin/Compress/Zlib.pm 2007-07-25 03:04:05 UTC (rev 6593)
+++ trunk/Catalyst-Plugin-Compress-Zlib/lib/Catalyst/Plugin/Compress/Zlib.pm 2007-07-27 17:00:11 UTC (rev 6594)
@@ -3,7 +3,7 @@
use strict;
use base 'Catalyst::Plugin::Compress::Gzip';
-our $VERSION = '0.02';
+our $VERSION = '0.03';
1;
More information about the Catalyst-commits
mailing list