changeset 511:1e0818200b3f

Tests: various expires variants.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 10 Dec 2014 16:39:52 +0300
parents 4892d701d558
children a610ee837190
files headers.t
diffstat 1 files changed, 47 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/headers.t
+++ b/headers.t
@@ -48,13 +48,49 @@ http {
 
         location /nx {
         }
+
+        location /epoch {
+            expires epoch;
+        }
+
+        location /max {
+            expires max;
+        }
+
+        location /off {
+            expires off;
+        }
+
+        location /access {
+            expires 2048;
+        }
+
+        location /negative {
+            expires -2048;
+        }
+
+        location /daily {
+            expires @15h30m33s;
+        }
+
+        location /modified {
+            expires modified 2048;
+        }
     }
 }
 
 EOF
 
 $t->write_file('t1', '');
-$t->try_run('no add_header always')->plan(6);
+$t->write_file('epoch', '');
+$t->write_file('max', '');
+$t->write_file('off', '');
+$t->write_file('access', '');
+$t->write_file('negative', '');
+$t->write_file('daily', '');
+$t->write_file('modified', '');
+
+$t->try_run('no add_header always')->plan(13);
 
 ###############################################################################
 
@@ -72,4 +108,14 @@ unlike($r, qr/Cache-Control/, 'bad expir
 unlike($r, qr/X-URI/, 'bad add_header');
 like($r, qr/X-Always/, 'bad add_header always');
 
+# various expires variants
+
+like(http_get('/epoch'), qr/Expires:.*1970/, 'expires epoch');
+like(http_get('/max'), qr/Expires:.*2037/, 'expires max');
+unlike(http_get('/off'), qr/Expires:/, 'expires off');
+like(http_get('/access'), qr/max-age=2048/, 'expires access');
+like(http_get('/negative'), qr/no-cache/, 'expires negative');
+like(http_get('/daily'), qr/Expires:.*:33 GMT/, 'expires daily');
+like(http_get('/modified'), qr/max-age=2048/, 'expires modified');
+
 ###############################################################################