Mercurial > hg > nginx-tests
comparison proxy-cache.t @ 101:6303927c18d2
Tests: proxy cache tests for problems with duplicate final chunks.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 02 Oct 2009 01:26:30 +0400 |
parents | f92852da34aa |
children | 8bc9de6559a1 |
comparison
equal
deleted
inserted
replaced
100:9ddc18214854 | 101:6303927c18d2 |
---|---|
7 ############################################################################### | 7 ############################################################################### |
8 | 8 |
9 use warnings; | 9 use warnings; |
10 use strict; | 10 use strict; |
11 | 11 |
12 use Test::More tests => 7; | 12 use Test::More tests => 9; |
13 | 13 |
14 BEGIN { use FindBin; chdir($FindBin::Bin); } | 14 BEGIN { use FindBin; chdir($FindBin::Bin); } |
15 | 15 |
16 use lib 'lib'; | 16 use lib 'lib'; |
17 use Test::Nginx; | 17 use Test::Nginx qw/ :DEFAULT :gzip /; |
18 | 18 |
19 ############################################################################### | 19 ############################################################################### |
20 | 20 |
21 select STDERR; $| = 1; | 21 select STDERR; $| = 1; |
22 select STDOUT; $| = 1; | 22 select STDOUT; $| = 1; |
44 | 44 |
45 server { | 45 server { |
46 listen 127.0.0.1:8080; | 46 listen 127.0.0.1:8080; |
47 server_name localhost; | 47 server_name localhost; |
48 | 48 |
49 gzip on; | |
50 gzip_min_length 0; | |
51 | |
49 location / { | 52 location / { |
50 proxy_pass http://127.0.0.1:8081; | 53 proxy_pass http://127.0.0.1:8081; |
51 | 54 |
52 proxy_cache NAME; | 55 proxy_cache NAME; |
53 | 56 |
54 proxy_cache_valid 200 302 1h; | 57 proxy_cache_valid 200 302 1s; |
55 proxy_cache_valid 301 1d; | 58 proxy_cache_valid 301 1d; |
56 proxy_cache_valid any 1m; | 59 proxy_cache_valid any 1m; |
57 | 60 |
58 proxy_cache_min_uses 1; | 61 proxy_cache_min_uses 1; |
59 | 62 |
60 proxy_cache_use_stale error timeout invalid_header http_500; | 63 proxy_cache_use_stale error timeout invalid_header http_500 |
64 http_404; | |
61 } | 65 } |
62 } | 66 } |
63 server { | 67 server { |
64 listen 127.0.0.1:8081; | 68 listen 127.0.0.1:8081; |
65 server_name localhost; | 69 server_name localhost; |
89 | 93 |
90 like(http_get('/empty.html'), qr/HTTP/, 'empty get first'); | 94 like(http_get('/empty.html'), qr/HTTP/, 'empty get first'); |
91 { | 95 { |
92 local $TODO = 'not fixed yet'; | 96 local $TODO = 'not fixed yet'; |
93 like(http_get('/empty.html'), qr/HTTP/, 'empty get second'); | 97 like(http_get('/empty.html'), qr/HTTP/, 'empty get second'); |
98 | |
99 sleep(2); | |
100 unlink $t->testdir() . '/t.html'; | |
101 like(http_gzip_request('/t.html'), | |
102 qr/HTTP.*1c\x0d\x0a.{28}\x0d\x0a0\x0d\x0a\x0d\x0a\z/s, | |
103 'non-empty get stale'); | |
94 } | 104 } |
95 | 105 |
106 unlink $t->testdir() . '/empty.html'; | |
107 like(http_gzip_request('/empty.html'), | |
108 qr/HTTP.*14\x0d\x0a.{20}\x0d\x0a0\x0d\x0a\x0d\x0a\z/s, | |
109 'empty get stale'); | |
110 | |
96 ############################################################################### | 111 ############################################################################### |