changeset 329:98c6af2a5138

Tests: location on caseless systems (ticket #90).
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 14 Sep 2013 03:44:02 +0400
parents 290d539efcb4
children 617f72beba8d
files http_location.t
diffstat 1 files changed, 25 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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');
+
+}
+
 ###############################################################################