# HG changeset patch # User Sergey Kandaurov # Date 1512557572 -10800 # Node ID fc43a3555095b7edac0c7ba3c34fcba576b69766 # Parent b113eeca94ad29e84896d76118a3f4c5eaba6db4 Tests: added uri escaping tests to proxy_cache_use_stale.t. diff --git a/proxy_cache_use_stale.t b/proxy_cache_use_stale.t --- a/proxy_cache_use_stale.t +++ b/proxy_cache_use_stale.t @@ -50,6 +50,13 @@ http { 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 @@ EOF $t->write_file('t7.html', 'SEE-THIS' x 1024); $t->write_file('t9.html', 'SEE-THIS' x 1024); $t->write_file('ssi.html', 'xxx 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 @@ http_get('/ssi.html'); 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($r, qr/^xxx (SEE-THIS){1024} xxx$/m 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 {