Mercurial > hg > ngx_http_gunzip_filter_module
comparison 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 |
comparison
equal
deleted
inserted
replaced
10:e60753404354 | 11:b12d2ee20755 |
---|---|
18 select STDOUT; $| = 1; | 18 select STDOUT; $| = 1; |
19 | 19 |
20 eval { require IO::Compress::Gzip; }; | 20 eval { require IO::Compress::Gzip; }; |
21 Test::More::plan(skip_all => "IO::Compress::Gzip not found") if $@; | 21 Test::More::plan(skip_all => "IO::Compress::Gzip not found") if $@; |
22 | 22 |
23 my $t = Test::Nginx->new()->has(qw/http proxy gzip_static/)->plan(12); | 23 my $t = Test::Nginx->new()->has(qw/http proxy gzip_static/)->plan(13); |
24 | 24 |
25 $t->write_file_expand('nginx.conf', <<'EOF'); | 25 $t->write_file_expand('nginx.conf', <<'EOF'); |
26 | 26 |
27 master_process off; | 27 master_process off; |
28 daemon off; | 28 daemon off; |
75 | 75 |
76 $t->write_file('t1.gz', $out); | 76 $t->write_file('t1.gz', $out); |
77 $t->write_file('t2.gz', $out . $out); | 77 $t->write_file('t2.gz', $out . $out); |
78 $t->write_file('t3', 'not compressed'); | 78 $t->write_file('t3', 'not compressed'); |
79 | 79 |
80 my $emptyin = ''; | |
81 my $emptyout; | |
82 IO::Compress::Gzip::gzip(\$emptyin => \$emptyout); | |
83 | |
84 $t->write_file('empty.gz', $emptyout); | |
85 | |
80 $t->run(); | 86 $t->run(); |
81 | 87 |
82 ############################################################################### | 88 ############################################################################### |
83 | 89 |
84 pass('runs'); | 90 pass('runs'); |
100 like(http_get('/t1'), qr/Vary/, 'get vary'); | 106 like(http_get('/t1'), qr/Vary/, 'get vary'); |
101 like(http_head('/t1'), qr/Vary/, 'head vary'); | 107 like(http_head('/t1'), qr/Vary/, 'head vary'); |
102 unlike(http_get('/t3'), qr/Vary/, 'no vary on non-gzipped get'); | 108 unlike(http_get('/t3'), qr/Vary/, 'no vary on non-gzipped get'); |
103 unlike(http_head('/t3'), qr/Vary/, 'no vary on non-gzipped head'); | 109 unlike(http_head('/t3'), qr/Vary/, 'no vary on non-gzipped head'); |
104 | 110 |
111 like(http_get('/empty'), qr/ 200 /, 'gunzip empty'); | |
112 | |
105 ############################################################################### | 113 ############################################################################### |