Mercurial > hg > nginx-tests
comparison ssi.t @ 502:134ea15d7473
Tests: SSI test with "postpone_output 0" (ticket #132).
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 27 Nov 2014 07:00:10 +0300 |
parents | 847ea345becb |
children | 071e8941e3bf |
comparison
equal
deleted
inserted
replaced
501:0ee2899fbe3e | 502:134ea15d7473 |
---|---|
21 select STDERR; $| = 1; | 21 select STDERR; $| = 1; |
22 select STDOUT; $| = 1; | 22 select STDOUT; $| = 1; |
23 | 23 |
24 plan(skip_all => 'win32') if $^O eq 'MSWin32'; | 24 plan(skip_all => 'win32') if $^O eq 'MSWin32'; |
25 | 25 |
26 my $t = Test::Nginx->new()->has(qw/http ssi cache proxy rewrite/)->plan(27); | 26 my $t = Test::Nginx->new()->has(qw/http ssi cache proxy rewrite/)->plan(28); |
27 | 27 |
28 $t->write_file_expand('nginx.conf', <<'EOF'); | 28 $t->write_file_expand('nginx.conf', <<'EOF'); |
29 | 29 |
30 %%TEST_GLOBALS%% | 30 %%TEST_GLOBALS%% |
31 | 31 |
61 proxy_cache_valid 200 1h; | 61 proxy_cache_valid 200 1h; |
62 } | 62 } |
63 location /local/ { | 63 location /local/ { |
64 ssi off; | 64 ssi off; |
65 alias %%TESTDIR%%/; | 65 alias %%TESTDIR%%/; |
66 } | |
67 location = /test-empty-postpone.html { | |
68 ssi on; | |
69 postpone_output 0; | |
66 } | 70 } |
67 location /var { | 71 location /var { |
68 ssi on; | 72 ssi on; |
69 add_header X-Var $date_gmt; | 73 add_header X-Var $date_gmt; |
70 } | 74 } |
92 $t->write_file('test-empty1.html', 'X<!--#include virtual="/empty.html" -->X'); | 96 $t->write_file('test-empty1.html', 'X<!--#include virtual="/empty.html" -->X'); |
93 $t->write_file('test-empty2.html', | 97 $t->write_file('test-empty2.html', |
94 'X<!--#include virtual="/local/empty.html" -->X'); | 98 'X<!--#include virtual="/local/empty.html" -->X'); |
95 $t->write_file('test-empty3.html', | 99 $t->write_file('test-empty3.html', |
96 'X<!--#include virtual="/cache/empty.html" -->X'); | 100 'X<!--#include virtual="/cache/empty.html" -->X'); |
101 $t->write_file('test-empty-postpone.html', | |
102 'X<!--#include virtual="/proxy/empty.html" -->X'); | |
97 $t->write_file('empty.html', ''); | 103 $t->write_file('empty.html', ''); |
98 | 104 |
99 $t->write_file('unescape.html?', 'SEE-THIS'); | 105 $t->write_file('unescape.html?', 'SEE-THIS'); |
100 $t->write_file('unescape1.html', | 106 $t->write_file('unescape1.html', |
101 'X<!--#include virtual="/tes%741.html?test=test" -->X'); | 107 'X<!--#include virtual="/tes%741.html?test=test" -->X'); |
144 unlike(http_get('/test1.html'), qr/Last-Modified|Accept-Ranges/im, | 150 unlike(http_get('/test1.html'), qr/Last-Modified|Accept-Ranges/im, |
145 'cleared headers'); | 151 'cleared headers'); |
146 unlike(http_get('/proxy/test1.html'), qr/Last-Modified|Accept-Ranges/im, | 152 unlike(http_get('/proxy/test1.html'), qr/Last-Modified|Accept-Ranges/im, |
147 'cleared headers from proxy'); | 153 'cleared headers from proxy'); |
148 | 154 |
155 # empty subrequests | |
156 | |
149 like(http_get('/test-empty1.html'), qr/HTTP/, 'empty with ssi'); | 157 like(http_get('/test-empty1.html'), qr/HTTP/, 'empty with ssi'); |
150 like(http_get('/test-empty2.html'), qr/HTTP/, 'empty without ssi'); | 158 like(http_get('/test-empty2.html'), qr/HTTP/, 'empty without ssi'); |
151 like(http_get('/test-empty3.html'), qr/HTTP/, 'empty with proxy'); | 159 like(http_get('/test-empty3.html'), qr/HTTP/, 'empty with proxy'); |
152 like(http_get('/test-empty3.html'), qr/HTTP/, 'empty with proxy cached'); | 160 like(http_get('/test-empty3.html'), qr/HTTP/, 'empty with proxy cached'); |
161 | |
162 TODO: { | |
163 local $TODO = 'not yet'; | |
164 | |
165 like(http_get('/test-empty-postpone.html'), qr/HTTP.*XX/ms, | |
166 'empty with postpone_output 0'); | |
167 | |
168 } | |
153 | 169 |
154 # handling of escaped URIs | 170 # handling of escaped URIs |
155 | 171 |
156 like(http_get('/unescape1.html'), qr/^XXtestXX$/m, 'escaped in path'); | 172 like(http_get('/unescape1.html'), qr/^XXtestXX$/m, 'escaped in path'); |
157 like(http_get('/unescape2.html'), qr/^XSEE-THISX$/m, | 173 like(http_get('/unescape2.html'), qr/^XSEE-THISX$/m, |
174 like(http_get('/var_format.html?custom=1'), | 190 like(http_get('/var_format.html?custom=1'), |
175 qr/x\w+, \d\d:\d\d:\d\dx/, 'custom ssi'); | 191 qr/x\w+, \d\d:\d\d:\d\dx/, 'custom ssi'); |
176 like(http_get('/var_format.html'), | 192 like(http_get('/var_format.html'), |
177 qr/x\w+, \d\d-\w{3}-\d{4} \d\d:\d\d:\d\d \w+x/, 'default ssi'); | 193 qr/x\w+, \d\d-\w{3}-\d{4} \d\d:\d\d:\d\d \w+x/, 'default ssi'); |
178 | 194 |
195 TODO: { | |
196 local $TODO = 'not yet'; | |
197 | |
179 like(`grep -F '[alert]' ${\($t->testdir())}/error.log`, qr/^$/s, 'no alerts'); | 198 like(`grep -F '[alert]' ${\($t->testdir())}/error.log`, qr/^$/s, 'no alerts'); |
180 | 199 |
181 ############################################################################### | 200 } |
201 | |
202 ############################################################################### |