diff t/gunzip.t @ 11:b12d2ee20755

Gunzip: fix gunzip of empty gzip stream. Reported by: Matthieu Tourne
author Maxim Dounin <mdounin@mdounin.ru>
date Sun, 07 Mar 2010 17:05:43 +0300
parents 7170c171150c
children c0301992025a
line wrap: on
line diff
--- a/t/gunzip.t
+++ b/t/gunzip.t
@@ -20,7 +20,7 @@ select STDOUT; $| = 1;
 eval { require IO::Compress::Gzip; };
 Test::More::plan(skip_all => "IO::Compress::Gzip not found") if $@;
 
-my $t = Test::Nginx->new()->has(qw/http proxy gzip_static/)->plan(12);
+my $t = Test::Nginx->new()->has(qw/http proxy gzip_static/)->plan(13);
 
 $t->write_file_expand('nginx.conf', <<'EOF');
 
@@ -77,6 +77,12 @@ IO::Compress::Gzip::gzip(\$in => \$out);
 $t->write_file('t2.gz', $out . $out);
 $t->write_file('t3', 'not compressed');
 
+my $emptyin = '';
+my $emptyout;
+IO::Compress::Gzip::gzip(\$emptyin => \$emptyout);
+
+$t->write_file('empty.gz', $emptyout);
+
 $t->run();
 
 ###############################################################################
@@ -102,4 +108,6 @@ like(http_head('/t1'), qr/Vary/, 'head v
 unlike(http_get('/t3'), qr/Vary/, 'no vary on non-gzipped get');
 unlike(http_head('/t3'), qr/Vary/, 'no vary on non-gzipped head');
 
+like(http_get('/empty'), qr/ 200 /, 'gunzip empty');
+
 ###############################################################################