# HG changeset patch # User Maxim Dounin # Date 1336042110 -14400 # Node ID 7f5095965c882bbada4890b207e2f2318b9cf003 # Parent 35d050d7d5f1e412e85a86e8da67fb9dcc4cef41 Tests: added rewrite tests for ticket #162. diff --git a/rewrite.t b/rewrite.t --- a/rewrite.t +++ b/rewrite.t @@ -21,7 +21,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(19) +my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(21) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -116,6 +116,16 @@ http { location /directory { } + + location /capture { + rewrite ^(.*) $1?c=d; + return 200 "uri:$uri args:$args"; + } + + location /capturedup { + rewrite ^(.*) $1?c=$1; + return 200 "uri:$uri args:$args"; + } } } @@ -202,4 +212,20 @@ like(http_get('/error405directory'), qr!HTTP/1.1 301.*Location: http://!ms, 'error 405 directory redirect'); +# escaping of uri if there are args added in rewrite, and length +# is actually calculated (ticket #162) + +like(http_get('/capture/%25?a=b'), + qr!^uri:/capture/% args:c=d&a=b$!ms, + 'escape with added args'); + +TODO: { +local $TODO = 'patch pending'; + +like(http_get('/capturedup/%25?a=b'), + qr!^uri:/capturedup/% args:c=/capturedup/%25&a=b$!ms, + 'escape with added args'); + +} + ###############################################################################