Mercurial > hg > nginx-tests
comparison headers.t @ 511:1e0818200b3f
Tests: various expires variants.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 10 Dec 2014 16:39:52 +0300 |
parents | 858e93175802 |
children | a610ee837190 |
comparison
equal
deleted
inserted
replaced
510:4892d701d558 | 511:1e0818200b3f |
---|---|
46 location /t1 { | 46 location /t1 { |
47 } | 47 } |
48 | 48 |
49 location /nx { | 49 location /nx { |
50 } | 50 } |
51 | |
52 location /epoch { | |
53 expires epoch; | |
54 } | |
55 | |
56 location /max { | |
57 expires max; | |
58 } | |
59 | |
60 location /off { | |
61 expires off; | |
62 } | |
63 | |
64 location /access { | |
65 expires 2048; | |
66 } | |
67 | |
68 location /negative { | |
69 expires -2048; | |
70 } | |
71 | |
72 location /daily { | |
73 expires @15h30m33s; | |
74 } | |
75 | |
76 location /modified { | |
77 expires modified 2048; | |
78 } | |
51 } | 79 } |
52 } | 80 } |
53 | 81 |
54 EOF | 82 EOF |
55 | 83 |
56 $t->write_file('t1', ''); | 84 $t->write_file('t1', ''); |
57 $t->try_run('no add_header always')->plan(6); | 85 $t->write_file('epoch', ''); |
86 $t->write_file('max', ''); | |
87 $t->write_file('off', ''); | |
88 $t->write_file('access', ''); | |
89 $t->write_file('negative', ''); | |
90 $t->write_file('daily', ''); | |
91 $t->write_file('modified', ''); | |
92 | |
93 $t->try_run('no add_header always')->plan(13); | |
58 | 94 |
59 ############################################################################### | 95 ############################################################################### |
60 | 96 |
61 my $r; | 97 my $r; |
62 | 98 |
70 $r = http_get('/nx'); | 106 $r = http_get('/nx'); |
71 unlike($r, qr/Cache-Control/, 'bad expires'); | 107 unlike($r, qr/Cache-Control/, 'bad expires'); |
72 unlike($r, qr/X-URI/, 'bad add_header'); | 108 unlike($r, qr/X-URI/, 'bad add_header'); |
73 like($r, qr/X-Always/, 'bad add_header always'); | 109 like($r, qr/X-Always/, 'bad add_header always'); |
74 | 110 |
111 # various expires variants | |
112 | |
113 like(http_get('/epoch'), qr/Expires:.*1970/, 'expires epoch'); | |
114 like(http_get('/max'), qr/Expires:.*2037/, 'expires max'); | |
115 unlike(http_get('/off'), qr/Expires:/, 'expires off'); | |
116 like(http_get('/access'), qr/max-age=2048/, 'expires access'); | |
117 like(http_get('/negative'), qr/no-cache/, 'expires negative'); | |
118 like(http_get('/daily'), qr/Expires:.*:33 GMT/, 'expires daily'); | |
119 like(http_get('/modified'), qr/max-age=2048/, 'expires modified'); | |
120 | |
75 ############################################################################### | 121 ############################################################################### |