# HG changeset patch # User Sergey Kandaurov # Date 1624957059 -10800 # Node ID 0605f9a6f7b034f0ebf0f86daeb4657d5ce5916f # Parent 6c03c329ed95f466762565441b8d3c81cf5ff7fc Tests: added ssi echo encoding tests. Notably, this covers strict URI characters escaping in HTML (NGX_ESCAPE_HTML). diff --git a/ssi.t b/ssi.t --- a/ssi.t +++ b/ssi.t @@ -22,7 +22,7 @@ select STDERR; $| = 1; select STDOUT; $| = 1; my $t = Test::Nginx->new()->has(qw/http ssi cache proxy rewrite/) - ->plan(27); + ->plan(30); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -90,6 +90,15 @@ EOF 'XX'); $t->write_file('test3.html', 'XX'); +$t->write_file('test4-echo-none.html', + 'X' + . 'X'); +$t->write_file('test5-echo-url.html', + 'X' + . 'X'); +$t->write_file('test6-echo-entity.html', + 'X' + . 'X'); $t->write_file('test-args-rewrite.html', 'XX'); $t->write_file('test-empty1.html', 'XX'); @@ -136,6 +145,20 @@ like(http_get('/test2.html'), qr/^XXtest like(http_get('/test3.html'), qr/^XtestX$/m, 'set'); +like(http_get('/test4-echo-none.html'), qr/^XX$/m, + 'echo encoding none'); + +TODO: { +local $TODO = 'no strict URI escaping yet' unless $t->has_version('1.21.1'); + +like(http_get('/test5-echo-url.html'), qr/^X%3Ctest%3EX$/m, + 'echo encoding url'); + +} + +like(http_get('/test6-echo-entity.html'), qr/^X<test>X$/m, + 'echo encoding entity'); + # args should be in subrequest even if original request has no args and that # was queried somehow (e.g. by server rewrites)