# HG changeset patch # User Sergey Kandaurov # Date 1559644844 -10800 # Node ID 54b92955e4e20f5f152ab7d2d7de6609ff1e80db # Parent 1220f0055135dc7615c977a9ff901d0dc527754d Tests: not_modified_finalize.t with cached response (ticket #1782). diff --git a/not_modified_finalize.t b/not_modified_finalize.t --- a/not_modified_finalize.t +++ b/not_modified_finalize.t @@ -21,7 +21,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http proxy cache/)->plan(1) +my $t = Test::Nginx->new()->has(qw/http proxy cache/)->plan(2) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -46,6 +46,7 @@ http { proxy_pass http://127.0.0.1:8081; proxy_cache cache; proxy_cache_lock on; + proxy_cache_valid 1h; } location /error412 { @@ -76,6 +77,21 @@ like(http_match_get('/t.html'), qr//, 'r $t->todo_alerts(); +# in addition, in 1.11.10 .. 1.17.1, if the response was previously +# cached, such a request resulted in r->cache null pointer dereference +# in ngx_http_upstream_cache_background_update(), after it was reset +# during internal redirect + +http_get('/t.html'); + +TODO: { +todo_skip 'leaves coredump', 1 unless $ENV{TEST_NGINX_UNSAFE} + or $t->has_version('1.17.1'); + +like(http_match_get('/t.html'), qr//, 'request 412 cached'); + +} + ############################################################################### sub http_match_get {