| # Tests for embedded perl module. |
| ############################################################################### |
| BEGIN { use FindBin; chdir($FindBin::Bin); } |
| use Test::Nginx qw/ :DEFAULT :gzip /; |
| ############################################################################### |
| eval { require IO::Compress::Gzip; }; |
| Test::More::plan(skip_all => "IO::Compress::Gzip not found") if $@; |
| my $t = Test::Nginx->new()->has(qw/http perl gzip/)->plan(2) |
| ->write_file_expand('nginx.conf', <<'EOF'); |
| $r->send_http_header("text/plain"); |
| return OK if $r->header_only; |
| $r->header_out("Content-Encoding", "gzip"); |
| $r->send_http_header("text/plain"); |
| return OK if $r->header_only; |
| IO::Compress::Gzip::gzip(\\$in => \\$out); |
| ############################################################################### |
| http_gzip_like(http_gzip_request('/'), qr/TEST/, 'perl response gzipped'); |
| local $TODO = 'patch pending'; |
| http_gzip_like(http_gzip_request('/gz'), qr/TEST/, 'not doublegzipped'); |
| ############################################################################### |