Mercurial > hg > nginx-tests
comparison gzip_flush.t @ 148:b714d6df958c
Tests: rename some tests for better sorting.
Use underscore instead of dash. Addtionally, rename some tests to better
match "module" + "details" scheme used: use "http_" prefix for http core
module tests, use "mail_" prefix for mail module tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 04 Mar 2011 16:07:15 +0300 |
parents | gzip-flush.t@e8546edb0267 |
children | c0ae29632905 |
comparison
equal
deleted
inserted
replaced
147:fd865ada95c8 | 148:b714d6df958c |
---|---|
1 #!/usr/bin/perl | |
2 | |
3 # (C) Maxim Dounin | |
4 | |
5 # Tests for gzip filter module. | |
6 | |
7 ############################################################################### | |
8 | |
9 use warnings; | |
10 use strict; | |
11 | |
12 use Test::More; | |
13 | |
14 BEGIN { use FindBin; chdir($FindBin::Bin); } | |
15 | |
16 use lib 'lib'; | |
17 use Test::Nginx qw/ :DEFAULT :gzip /; | |
18 | |
19 ############################################################################### | |
20 | |
21 select STDERR; $| = 1; | |
22 select STDOUT; $| = 1; | |
23 | |
24 my $t = Test::Nginx->new()->has(qw/http gzip perl/)->plan(2) | |
25 ->write_file_expand('nginx.conf', <<'EOF'); | |
26 | |
27 %%TEST_GLOBALS%% | |
28 | |
29 master_process off; | |
30 daemon off; | |
31 | |
32 events { | |
33 } | |
34 | |
35 http { | |
36 %%TEST_GLOBALS_HTTP%% | |
37 | |
38 server { | |
39 listen 127.0.0.1:8080; | |
40 server_name localhost; | |
41 | |
42 gzip on; | |
43 gzip_min_length 0; | |
44 | |
45 location / { | |
46 perl 'sub { | |
47 my $r = shift; | |
48 $r->send_http_header("text/html"); | |
49 return OK if $r->header_only; | |
50 $r->print("DA"); | |
51 $r->flush(); | |
52 $r->flush(); | |
53 $r->print("TA"); | |
54 return OK; | |
55 }'; | |
56 } | |
57 } | |
58 } | |
59 | |
60 EOF | |
61 | |
62 $t->run(); | |
63 | |
64 ############################################################################### | |
65 | |
66 like(http_get('/'), qr/DATA/, 'request with flush'); | |
67 | |
68 TODO: { | |
69 local $TODO = 'not yet'; | |
70 | |
71 # gzip filter doesn't properly handle empty flush buffers, see | |
72 # http://nginx.org/pipermail/nginx/2010-November/023693.html | |
73 | |
74 http_gzip_like(http_gzip_request('/'), qr/DATA/, 'gzip request with flush'); | |
75 | |
76 } | |
77 | |
78 ############################################################################### |