Mercurial > hg > nginx-tests
changeset 1414:f5b18471e17a
Tests: proxy cache background update with regex captures.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 11 Dec 2018 16:10:33 +0300 |
parents | 215f3357034b |
children | 01d806268a12 |
files | proxy_cache_use_stale.t |
diffstat | 1 files changed, 20 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/proxy_cache_use_stale.t Tue Dec 11 14:12:44 2018 +0300 +++ b/proxy_cache_use_stale.t Tue Dec 11 16:10:33 2018 +0300 @@ -82,6 +82,12 @@ proxy_cache_background_update off; } + location ~ /(reg)(?P<name>exp).html { + proxy_pass http://127.0.0.1:8081/$1$name.html; + + proxy_cache_background_update on; + } + location /updating/ { proxy_pass http://127.0.0.1:8081/; @@ -143,8 +149,9 @@ $t->write_file('ssi.html', 'xxx <!--#include virtual="/t9.html" --> xxx'); $t->write_file('escape.html', 'SEE-THIS'); $t->write_file('escape html', 'SEE-THIS'); +$t->write_file('regexp.html', 'SEE-THIS'); -$t->run()->plan(33); +$t->run()->plan(35); ############################################################################### @@ -167,6 +174,7 @@ 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'); +get('/regexp.html', 'max-age=1, stale-while-revalidate=10'); sleep 2; @@ -186,6 +194,17 @@ '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 + +like(http_get('/regexp.html'), qr/STALE/, 's-w-r - regexp background update'); + +TODO: { +local $TODO = 'not yet' unless $t->has_version('1.15.8'); + +like(http_get('/regexp.html'), qr/HIT/, 's-w-r - regexp revalidated'); + +} + # UPDATING while s-w-r $t->write_file('t6.html', 'SEE-THAT');