changeset 638:f758c780c508

Tests: If-Unmodified-Since for not modified filter with proxy. This covers "header already sent" alerts seen for responses from cache.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 29 Jul 2015 13:55:27 +0300
parents 443848f28a73
children 2b43ad56bce0
files not_modified_proxy.t
diffstat 1 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/not_modified_proxy.t
+++ b/not_modified_proxy.t
@@ -26,8 +26,8 @@ use Test::Nginx;
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
-my $t = Test::Nginx->new()->has(qw/http proxy cache shmem/)->plan(9)
-	->write_file_expand('nginx.conf', <<'EOF');
+my $t = Test::Nginx->new()->has(qw/http proxy cache shmem/)->plan(12)
+	->write_file_expand('nginx.conf', <<'EOF')->todo_alerts();
 
 %%TEST_GLOBALS%%
 
@@ -42,6 +42,7 @@ http {
     proxy_cache_path %%TESTDIR%%/cache keys_zone=one:1m;
 
     proxy_set_header If-Modified-Since "";
+    proxy_set_header If-Unmodified-Since "";
     proxy_set_header If-None-Match "";
 
     server {
@@ -86,6 +87,12 @@ like(http_get_ims('/t', $lm), qr/ 304 /,
 like(http_get_ims('/proxy/t', $lm), qr/ 200 /, 'ims proxy ignored');
 like(http_get_ims('/cache/t', $lm), qr/ 304 /, 'ims from cache');
 
+$t1 = 'Fri, 05 Jul 1985 14:30:52 GMT';
+
+like(http_get_iums('/t', $t1), qr/ 412 /, 'if-unmodified-since');
+like(http_get_iums('/proxy/t', $t1), qr/ 200 /, 'iums proxy ignored');
+like(http_get_iums('/cache/t', $t1), qr/ 412 /, 'iums from cache');
+
 like(http_get_inm('/t', $etag), qr/ 304 /, 'if-none-match');
 like(http_get_inm('/proxy/t', $etag), qr/ 200 /, 'inm proxy ignored');
 like(http_get_inm('/cache/t', $etag), qr/ 304 /, 'inm from cache');
@@ -111,6 +118,16 @@ If-Modified-Since: $ims
 EOF
 }
 
+sub http_get_iums {
+	my ($url, $ims) = @_;
+	return http(<<EOF);
+GET $url HTTP/1.0
+Host: localhost
+If-Unmodified-Since: $ims
+
+EOF
+}
+
 sub http_get_inm {
 	my ($url, $inm) = @_;
 	return http(<<EOF);