# HG changeset patch # User Maxim Dounin # Date 1379115842 -14400 # Node ID 98c6af2a51382260b4eb4e80f9eeb4641d6ed4df # Parent 290d539efcb4fe450ee7158f919f8fc8307e1b29 Tests: location on caseless systems (ticket #90). diff --git a/http_location.t b/http_location.t --- a/http_location.t +++ b/http_location.t @@ -21,7 +21,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(8) +my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(10) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -62,6 +62,16 @@ http { add_header X-Location casefull; return 204; } + + location /lowercase { + add_header X-Location lowercase; + return 204; + } + + location /UPPERCASE { + add_header X-Location uppercase; + return 204; + } } } @@ -87,4 +97,18 @@ SKIP: { 'casefull regex do not match wrong case'); } +# on case-insensitive systems a request to "/UPPERCASE" fails, +# as location search tree is incorrectly sorted if uppercase +# characters are used in location directives (ticket #90) + +like(http_get('/lowercase'), qr/X-Location: lowercase/, 'lowercase'); + +TODO: { +local $TODO = 'fails on caseless oses' + if $^O eq 'MSWin32' or $^O eq 'darwin'; + +like(http_get('/UPPERCASE'), qr/X-Location: uppercase/, 'uppercase'); + +} + ###############################################################################