Mercurial > hg > nginx-tests
comparison http_location.t @ 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 | 6a0d934950bc |
children | 433be52171d5 |
comparison
equal
deleted
inserted
replaced
328:290d539efcb4 | 329:98c6af2a5138 |
---|---|
19 ############################################################################### | 19 ############################################################################### |
20 | 20 |
21 select STDERR; $| = 1; | 21 select STDERR; $| = 1; |
22 select STDOUT; $| = 1; | 22 select STDOUT; $| = 1; |
23 | 23 |
24 my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(8) | 24 my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(10) |
25 ->write_file_expand('nginx.conf', <<'EOF'); | 25 ->write_file_expand('nginx.conf', <<'EOF'); |
26 | 26 |
27 %%TEST_GLOBALS%% | 27 %%TEST_GLOBALS%% |
28 | 28 |
29 daemon off; | 29 daemon off; |
60 | 60 |
61 location ~ casefull { | 61 location ~ casefull { |
62 add_header X-Location casefull; | 62 add_header X-Location casefull; |
63 return 204; | 63 return 204; |
64 } | 64 } |
65 | |
66 location /lowercase { | |
67 add_header X-Location lowercase; | |
68 return 204; | |
69 } | |
70 | |
71 location /UPPERCASE { | |
72 add_header X-Location uppercase; | |
73 return 204; | |
74 } | |
65 } | 75 } |
66 } | 76 } |
67 | 77 |
68 EOF | 78 EOF |
69 | 79 |
85 | 95 |
86 like(http_get('/CASEFULL/'), qr/X-Location: root/, | 96 like(http_get('/CASEFULL/'), qr/X-Location: root/, |
87 'casefull regex do not match wrong case'); | 97 'casefull regex do not match wrong case'); |
88 } | 98 } |
89 | 99 |
100 # on case-insensitive systems a request to "/UPPERCASE" fails, | |
101 # as location search tree is incorrectly sorted if uppercase | |
102 # characters are used in location directives (ticket #90) | |
103 | |
104 like(http_get('/lowercase'), qr/X-Location: lowercase/, 'lowercase'); | |
105 | |
106 TODO: { | |
107 local $TODO = 'fails on caseless oses' | |
108 if $^O eq 'MSWin32' or $^O eq 'darwin'; | |
109 | |
110 like(http_get('/UPPERCASE'), qr/X-Location: uppercase/, 'uppercase'); | |
111 | |
112 } | |
113 | |
90 ############################################################################### | 114 ############################################################################### |