Mercurial > hg > nginx-tests
comparison headers.t @ 1212:0469ef3fcd34
Tests: added "expires modified" test with proxy.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 29 Aug 2017 17:03:54 +0300 |
parents | 196d33c2bb45 |
children | 97c8280de681 |
comparison
equal
deleted
inserted
replaced
1211:0c15ba7d19b3 | 1212:0469ef3fcd34 |
---|---|
21 ############################################################################### | 21 ############################################################################### |
22 | 22 |
23 select STDERR; $| = 1; | 23 select STDERR; $| = 1; |
24 select STDOUT; $| = 1; | 24 select STDOUT; $| = 1; |
25 | 25 |
26 my $t = Test::Nginx->new()->has(qw/http/)->plan(27) | 26 my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(28) |
27 ->write_file_expand('nginx.conf', <<'EOF'); | 27 ->write_file_expand('nginx.conf', <<'EOF'); |
28 | 28 |
29 %%TEST_GLOBALS%% | 29 %%TEST_GLOBALS%% |
30 | 30 |
31 daemon off; | 31 daemon off; |
80 expires @15h30m33s; | 80 expires @15h30m33s; |
81 } | 81 } |
82 | 82 |
83 location /modified { | 83 location /modified { |
84 expires modified 2048; | 84 expires modified 2048; |
85 | |
86 location /modified/proxy { | |
87 proxy_pass http://127.0.0.1:8081/modified; | |
88 } | |
85 } | 89 } |
86 | 90 |
87 location /var { | 91 location /var { |
88 expires $arg_e; | 92 expires $arg_e; |
89 | 93 |
93 | 97 |
94 location /var_modified { | 98 location /var_modified { |
95 expires modified $arg_e; | 99 expires modified $arg_e; |
96 } | 100 } |
97 } | 101 } |
102 } | |
103 | |
104 server { | |
105 listen 127.0.0.1:8081; | |
106 server_name localhost; | |
107 | |
108 add_header Last-Modified "Mon, 28 Sep 1970 06:00:00 GMT"; | |
98 } | 109 } |
99 } | 110 } |
100 | 111 |
101 EOF | 112 EOF |
102 | 113 |
142 like(http_get('/access_inner'), qr/max-age=2048/, 'expires inner'); | 153 like(http_get('/access_inner'), qr/max-age=2048/, 'expires inner'); |
143 like(http_get('/negative'), qr/no-cache/, 'expires negative'); | 154 like(http_get('/negative'), qr/no-cache/, 'expires negative'); |
144 like(http_get('/daily'), qr/Expires:.*:33 GMT/, 'expires daily'); | 155 like(http_get('/daily'), qr/Expires:.*:33 GMT/, 'expires daily'); |
145 like(http_get('/modified'), qr/max-age=204./, 'expires modified'); | 156 like(http_get('/modified'), qr/max-age=204./, 'expires modified'); |
146 | 157 |
158 # "expires modified" with proxy | |
159 | |
160 TODO: { | |
161 local $TODO = 'not yet' unless $t->has_version('1.13.5'); | |
162 | |
163 like(http_get('/modified/proxy'), qr/Expires: Mon, 28 Sep 1970 06:34:08 GMT/, | |
164 'expires modified proxy'); | |
165 | |
166 } | |
167 | |
147 # expires with variables | 168 # expires with variables |
148 | 169 |
149 like(http_get('/var?e=epoch'), qr/Expires:.*1970/, 'expires var epoch'); | 170 like(http_get('/var?e=epoch'), qr/Expires:.*1970/, 'expires var epoch'); |
150 like(http_get('/var?e=max'), qr/Expires:.*2037/, 'expires var max'); | 171 like(http_get('/var?e=max'), qr/Expires:.*2037/, 'expires var max'); |
151 unlike(http_get('/var?e=off'), qr/Expires:/, 'expires var off'); | 172 unlike(http_get('/var?e=off'), qr/Expires:/, 'expires var off'); |