Mercurial > hg > nginx-tests
changeset 1256:fc43a3555095
Tests: added uri escaping tests to proxy_cache_use_stale.t.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 06 Dec 2017 13:52:52 +0300 |
parents | b113eeca94ad |
children | 05b2033f5377 |
files | proxy_cache_use_stale.t |
diffstat | 1 files changed, 31 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/proxy_cache_use_stale.t Tue Dec 05 13:52:50 2017 +0300 +++ b/proxy_cache_use_stale.t Wed Dec 06 13:52:52 2017 +0300 @@ -50,6 +50,13 @@ sendfile_max_chunk 4k; } + location /escape { + proxy_pass http://127.0.0.1:8081; + proxy_cache NAME; + proxy_cache_background_update on; + add_header X-Cache-Status $upstream_cache_status; + } + location / { proxy_pass http://127.0.0.1:8081; @@ -134,8 +141,10 @@ $t->write_file('t7.html', 'SEE-THIS' x 1024); $t->write_file('t9.html', 'SEE-THIS' x 1024); $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->run()->plan(29); +$t->run()->plan(33); ############################################################################### @@ -156,6 +165,8 @@ get('/updating/t.html', 'max-age=1'); get('/updating/t2.html', 'max-age=1, stale-while-revalidate=2'); 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'); sleep 2; @@ -236,6 +247,25 @@ like(http_get('/t2.html?if=1'), qr/STALE/, 'background update in if'); like(http_get('/t2.html?if=1'), qr/HIT/, 'background update in if - updated'); +# ticket #1430, uri escaping in cloned subrequests + +$t->write_file('escape.html', 'SEE-THAT'); +$t->write_file('escape html', 'SEE-THAT'); + +get('/escape.htm%6C', 'max-age=1'); +get('/escape html', 'max-age=1'); + +TODO: { +local $TODO = 'not yet' unless $t->has_version('1.13.8'); + +like(http_get('/escape.htm%6C'), qr/HIT/, 'escaped after escaped'); +like(http_get('/escape.html'), qr/MISS/, 'unescaped after escaped'); +like(http_get('/escape html'), qr/HIT/, 'space after escaped space'); + +} + +like(http_get('/escape%20html'), qr/HIT/, 'escaped space after escaped space'); + ############################################################################### sub get {