Tests: 4xx and 5xx codes with stale-while-revalidate.
Now these codes do not fall under stale-if-error (enabled by
stale-while-revalidate).
diff --git a/proxy_cache_use_stale.t b/proxy_cache_use_stale.t
index 57ec351..8fbd838 100644
--- a/proxy_cache_use_stale.t
+++ b/proxy_cache_use_stale.t
@@ -151,7 +151,7 @@
$t->write_file('escape html', 'SEE-THIS');
$t->write_file('regexp.html', 'SEE-THIS');
-$t->run()->plan(35);
+$t->run()->plan(36);
###############################################################################
@@ -171,6 +171,7 @@
http_get('/ssi.html');
get('/updating/t.html', 'max-age=1');
get('/updating/t2.html', 'max-age=1, stale-while-revalidate=2');
+get('/updating/tt.html', 'max-age=1, stale-if-error=5');
get('/t8.html', 'stale-while-revalidate=10');
get('/escape.htm%6C', 'max-age=1, stale-while-revalidate=10');
get('/escape html', 'max-age=1, stale-while-revalidate=10');
@@ -178,8 +179,18 @@
sleep 2;
-like(http_get('/t.html?e=1'), qr/STALE/, 's-i-e - stale');
-like(http_get('/tt.html?e=1'), qr/STALE/, 's-i-e - stale 2');
+TODO: {
+local $TODO = 'not yet' unless $t->has_version('1.19.3');
+
+# stale 5xx response is ignored since 1.19.3,
+# "proxy_cache_use_stale updating;" allows to get it still
+
+like(http_get('/t.html?e=1'), qr/ 500 /, 's-i-e - stale 5xx ignore');
+like(http_get('/tt.html?e=1'), qr/ 500 /, 's-i-e - stale 5xx ignore 2');
+
+}
+
+like(http_get('/updating/tt.html'), qr/STALE/, 's-i-e - stale 5xx updating');
like(http_get('/t.html'), qr/REVALIDATED/, 's-i-e - revalidated');
like(http_get('/t2.html?e=1'), qr/STALE/, 's-w-r - revalidate error');
@@ -190,8 +201,14 @@
's-w-r - unconditional revalidate');
like(http_get('/t4.html'), qr/HIT/, 's-w-r - unconditional revalidated');
-like(http_get('/t5.html?e=1'), qr/STALE/,
+TODO: {
+local $TODO = 'not yet' unless $t->has_version('1.19.3');
+
+like(http_get('/t5.html?e=1'), qr/ 500 /,
's-w-r - foreground revalidate error');
+
+}
+
like(http_get('/t5.html'), qr/REVALIDATED/, 's-w-r - foreground revalidated');
# proxy_pass to regular expression with named and positional captures