comparison ssi.t @ 573:517cde5075d8

Tests: improved time zone name checks for $date_gmt in ssi.t. Time zone name format is implementation defined, and, e.g., on win32 it may contain spaces, such as "Pacific Standard Time" for PST. While here, catch this in headers as well.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 13 May 2015 16:57:45 +0300
parents 907e89fba9c3
children 2cd00179f4b2
comparison
equal deleted inserted replaced
572:ca54b445d982 573:517cde5075d8
68 ssi on; 68 ssi on;
69 postpone_output 0; 69 postpone_output 0;
70 } 70 }
71 location /var { 71 location /var {
72 ssi on; 72 ssi on;
73 add_header X-Var $date_gmt; 73 add_header X-Var x${date_gmt}x;
74 } 74 }
75 location /var_noformat { 75 location /var_noformat {
76 ssi on; 76 ssi on;
77 add_header X-Var $date_gmt; 77 add_header X-Var x${date_gmt}x;
78 return 200; 78 return 200;
79 } 79 }
80 location /var_nossi { 80 location /var_nossi {
81 add_header X-Var $date_gmt; 81 add_header X-Var x${date_gmt}x;
82 return 200; 82 return 200;
83 } 83 }
84 } 84 }
85 } 85 }
86 86
170 like(http_get('/unescape3.html'), qr/404 Not Found/, 170 like(http_get('/unescape3.html'), qr/404 Not Found/,
171 'escaped query separator'); 171 'escaped query separator');
172 172
173 # handling of embedded date variables 173 # handling of embedded date variables
174 174
175 like(http_get('/var_nossi.html'), 175 my $re_date_gmt = qr/X-Var: x\w+, \d\d-\w{3}-\d{4} \d\d:\d\d:\d\d [\w ]+x/;
176 qr/X-Var: \w+, \d\d-\w{3}-\d{4} \d\d:\d\d:\d\d \w+/, 'no ssi');
177 like(http_get('/var_noformat.html'),
178 qr/X-Var: \w+, \d\d-\w{3}-\d{4} \d\d:\d\d:\d\d \w+/, 'no format');
179 176
180 like(http_get('/var_format.html?custom=1'), 177 like(http_get('/var_nossi.html'), $re_date_gmt, 'no ssi');
181 qr/X-Var: \w+, \d\d-\w{3}-\d{4} \d\d:\d\d:\d\d \w+/, 'custom header'); 178 like(http_get('/var_noformat.html'), $re_date_gmt, 'no format');
182 like(http_get('/var_format.html'), 179
183 qr/X-Var: \w+, \d\d-\w{3}-\d{4} \d\d:\d\d:\d\d \w+/, 'default header'); 180 like(http_get('/var_format.html?custom=1'), $re_date_gmt, 'custom header');
181 like(http_get('/var_format.html'), $re_date_gmt, 'default header');
184 182
185 like(http_get('/var_format.html?custom=1'), 183 like(http_get('/var_format.html?custom=1'),
186 qr/x\w+, \d\d:\d\d:\d\dx/, 'custom ssi'); 184 qr/x\w+, \d\d:\d\d:\d\dx/, 'custom ssi');
187 like(http_get('/var_format.html'), 185 like(http_get('/var_format.html'),
188 qr/x\w+, \d\d-\w{3}-\d{4} \d\d:\d\d:\d\d \w+x/, 'default ssi'); 186 qr/x\w+, \d\d-\w{3}-\d{4} \d\d:\d\d:\d\d [\w ]+x/, 'default ssi');
189 187
190 like(`grep -F '[alert]' ${\($t->testdir())}/error.log`, qr/^$/s, 'no alerts'); 188 like(`grep -F '[alert]' ${\($t->testdir())}/error.log`, qr/^$/s, 'no alerts');
191 189
192 ############################################################################### 190 ###############################################################################