comparison not_modified_finalize.t @ 1484:54b92955e4e2

Tests: not_modified_finalize.t with cached response (ticket #1782).
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 04 Jun 2019 13:40:44 +0300
parents fc3722dd8862
children 5ac6efbe5552
comparison
equal deleted inserted replaced
1483:1220f0055135 1484:54b92955e4e2
19 ############################################################################### 19 ###############################################################################
20 20
21 select STDERR; $| = 1; 21 select STDERR; $| = 1;
22 select STDOUT; $| = 1; 22 select STDOUT; $| = 1;
23 23
24 my $t = Test::Nginx->new()->has(qw/http proxy cache/)->plan(1) 24 my $t = Test::Nginx->new()->has(qw/http proxy cache/)->plan(2)
25 ->write_file_expand('nginx.conf', <<'EOF'); 25 ->write_file_expand('nginx.conf', <<'EOF');
26 26
27 %%TEST_GLOBALS%% 27 %%TEST_GLOBALS%%
28 28
29 daemon off; 29 daemon off;
44 44
45 location / { 45 location / {
46 proxy_pass http://127.0.0.1:8081; 46 proxy_pass http://127.0.0.1:8081;
47 proxy_cache cache; 47 proxy_cache cache;
48 proxy_cache_lock on; 48 proxy_cache_lock on;
49 proxy_cache_valid 1h;
49 } 50 }
50 51
51 location /error412 { 52 location /error412 {
52 } 53 }
53 } 54 }
74 75
75 like(http_match_get('/t.html'), qr//, 'request 412'); 76 like(http_match_get('/t.html'), qr//, 'request 412');
76 77
77 $t->todo_alerts(); 78 $t->todo_alerts();
78 79
80 # in addition, in 1.11.10 .. 1.17.1, if the response was previously
81 # cached, such a request resulted in r->cache null pointer dereference
82 # in ngx_http_upstream_cache_background_update(), after it was reset
83 # during internal redirect
84
85 http_get('/t.html');
86
87 TODO: {
88 todo_skip 'leaves coredump', 1 unless $ENV{TEST_NGINX_UNSAFE}
89 or $t->has_version('1.17.1');
90
91 like(http_match_get('/t.html'), qr//, 'request 412 cached');
92
93 }
94
79 ############################################################################### 95 ###############################################################################
80 96
81 sub http_match_get { 97 sub http_match_get {
82 my ($url, %extra) = @_; 98 my ($url, %extra) = @_;
83 return http(<<EOF, %extra); 99 return http(<<EOF, %extra);