# HG changeset patch # User Sergey Kandaurov # Date 1438167327 -10800 # Node ID f758c780c5083d67e7a79d528db1b8a39abc5bb3 # Parent 443848f28a73d946e354a30e6f8294840a6544d9 Tests: If-Unmodified-Since for not modified filter with proxy. This covers "header already sent" alerts seen for responses from cache. diff --git a/not_modified_proxy.t b/not_modified_proxy.t --- 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(<