Mercurial > hg > nginx-tests
annotate http_disable_symlinks.t @ 242:8f280348d76f
Tests: add has_version() method and use it as appropriate.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 26 Nov 2012 03:47:31 +0400 |
parents | 0a9e5d753fb8 |
children | 6a0d934950bc |
rev | line source |
---|---|
201
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
2 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
3 # (C) Andrey Belov |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
4 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
5 # Tests for disable_symlinks directive. |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
6 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
7 ############################################################################### |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
8 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
9 use warnings; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
10 use strict; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
11 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
12 use Test::More; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
13 use POSIX; |
202
067b6cb4793d
Tests: cleanup disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
201
diff
changeset
|
14 use Cwd qw/ realpath /; |
201
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
15 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
16 BEGIN { use FindBin; chdir($FindBin::Bin); } |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
17 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
18 use lib 'lib'; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
19 use Test::Nginx; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
20 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
21 ############################################################################### |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
22 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
23 select STDERR; $| = 1; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
24 select STDOUT; $| = 1; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
25 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
26 my $t = Test::Nginx->new()->has(qw/http rewrite/) |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
27 ->write_file_expand('nginx.conf', <<'EOF'); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
28 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
29 %%TEST_GLOBALS%% |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
30 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
31 daemon off; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
32 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
33 events { |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
34 } |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
35 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
36 http { |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
37 %%TEST_GLOBALS_HTTP%% |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
38 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
39 server { |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
40 listen 127.0.0.1:8080; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
41 server_name s1; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
42 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
43 location /on/ { |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
44 disable_symlinks on; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
45 } |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
46 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
47 location /not_owner/ { |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
48 disable_symlinks if_not_owner; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
49 } |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
50 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
51 location /try_on/ { |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
52 disable_symlinks on; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
53 try_files $uri $uri.html =404; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
54 } |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
55 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
56 location /try_not_owner/ { |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
57 disable_symlinks if_not_owner; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
58 try_files $uri $uri.txt =404; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
59 } |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
60 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
61 location /if_on/ { |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
62 disable_symlinks on; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
63 if (-f $request_filename) { |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
64 return 204; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
65 } |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
66 } |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
67 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
68 location /if_not_owner/ { |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
69 disable_symlinks if_not_owner; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
70 if (-f $request_filename) { |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
71 return 204; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
72 } |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
73 } |
203
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
74 |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
75 location /complex/1/ { |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
76 disable_symlinks on; |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
77 alias %%TESTDIR%%/./cached/../; |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
78 } |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
79 |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
80 location /complex/2/ { |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
81 disable_symlinks on; |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
82 alias %%TESTDIR%%//./cached/..//; |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
83 } |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
84 |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
85 location /complex/3/ { |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
86 disable_symlinks on; |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
87 alias ///%%TESTDIR%%//./cached/..//; |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
88 } |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
89 |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
90 location ~ (.+/)tail$ { |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
91 disable_symlinks on; |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
92 alias %%TESTDIR%%/$1; |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
93 } |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
94 |
204
d838248b643a
Tests: more disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
203
diff
changeset
|
95 location ~ (.+/)tailowner$ { |
d838248b643a
Tests: more disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
203
diff
changeset
|
96 disable_symlinks if_not_owner; |
d838248b643a
Tests: more disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
203
diff
changeset
|
97 alias %%TESTDIR%%/$1; |
d838248b643a
Tests: more disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
203
diff
changeset
|
98 } |
d838248b643a
Tests: more disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
203
diff
changeset
|
99 |
d838248b643a
Tests: more disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
203
diff
changeset
|
100 location ~ (.+/)tailoff$ { |
d838248b643a
Tests: more disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
203
diff
changeset
|
101 disable_symlinks off; |
d838248b643a
Tests: more disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
203
diff
changeset
|
102 alias %%TESTDIR%%/$1; |
d838248b643a
Tests: more disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
203
diff
changeset
|
103 } |
d838248b643a
Tests: more disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
203
diff
changeset
|
104 |
203
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
105 location /dir { |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
106 disable_symlinks on; |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
107 try_files $uri/ =404; |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
108 } |
206
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
109 |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
110 location /from { |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
111 disable_symlinks on from=$document_root; |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
112 |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
113 location /from/wo_slash { |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
114 alias %%TESTDIR%%/dirlink; |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
115 } |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
116 location /from/with_slash/ { |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
117 alias %%TESTDIR%%/dirlink/; |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
118 } |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
119 location ~ ^/from/exact/(.+)$ { |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
120 alias %%TESTDIR%%/$1; |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
121 } |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
122 } |
201
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
123 } |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
124 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
125 server { |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
126 listen 127.0.0.1:8080; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
127 server_name s2; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
128 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
129 open_file_cache max=16 inactive=60s; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
130 open_file_cache_valid 30s; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
131 open_file_cache_min_uses 1; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
132 open_file_cache_errors on; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
133 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
134 location /cached-off/ { |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
135 disable_symlinks off; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
136 alias %%TESTDIR%%/cached/; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
137 } |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
138 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
139 location /cached-on/ { |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
140 disable_symlinks on; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
141 alias %%TESTDIR%%/cached/; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
142 } |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
143 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
144 location /cached-if-not-owner/ { |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
145 disable_symlinks if_not_owner; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
146 alias %%TESTDIR%%/cached/; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
147 } |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
148 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
149 location / { |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
150 disable_symlinks off; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
151 } |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
152 } |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
153 } |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
154 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
155 EOF |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
156 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
157 eval { |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
158 open OLDERR, ">&", \*STDERR; close STDERR; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
159 $t->run(); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
160 open STDERR, ">&", \*OLDERR; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
161 }; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
162 plan(skip_all => 'no disable_symlinks') if $@; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
163 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
164 my $uid = getuid(); |
202
067b6cb4793d
Tests: cleanup disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
201
diff
changeset
|
165 my ($extfile) = grep { -f "$_" && $uid != (stat($_))[4] } |
067b6cb4793d
Tests: cleanup disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
201
diff
changeset
|
166 ('/etc/resolv.conf', '/etc/protocols', '/etc/host.conf'); |
201
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
167 |
202
067b6cb4793d
Tests: cleanup disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
201
diff
changeset
|
168 plan(skip_all => 'no external file found') |
067b6cb4793d
Tests: cleanup disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
201
diff
changeset
|
169 if !defined $extfile; |
201
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
170 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
171 my $d = $t->testdir(); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
172 |
206
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
173 $t->plan(28); |
202
067b6cb4793d
Tests: cleanup disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
201
diff
changeset
|
174 |
201
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
175 mkdir("$d/on"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
176 mkdir("$d/not_owner"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
177 mkdir("$d/try_on"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
178 mkdir("$d/try_not_owner"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
179 mkdir("$d/if_on"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
180 mkdir("$d/if_not_owner"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
181 mkdir("$d/cached"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
182 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
183 $t->write_file("empty.html", ""); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
184 symlink("empty.html", "$d/link"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
185 symlink($extfile, "$d/link2"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
186 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
187 $t->write_file("on/empty.html", ""); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
188 symlink("empty.html", "$d/on/link"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
189 symlink($extfile, "$d/on/link2"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
190 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
191 $t->write_file("not_owner/empty.html", ""); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
192 symlink("empty.html", "$d/not_owner/link"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
193 symlink($extfile, "$d/not_owner/link2"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
194 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
195 $t->write_file("try_on/try.html", "LOCAL TRY"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
196 symlink($extfile, "$d/try_on/try"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
197 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
198 $t->write_file("try_not_owner/try.html", "LOCAL TRY"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
199 symlink($extfile, "$d/try_not_owner/try"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
200 symlink("try.html", "$d/try_not_owner/try.txt"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
201 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
202 $t->write_file("if_on/empty.html", ""); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
203 symlink("empty.html", "$d/if_on/link"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
204 symlink($extfile, "$d/if_on/link2"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
205 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
206 $t->write_file("if_not_owner/empty.html", ""); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
207 symlink("empty.html", "$d/if_not_owner/link"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
208 symlink($extfile, "$d/if_not_owner/link2"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
209 |
203
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
210 mkdir("$d/dir"); |
206
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
211 $t->write_file("dir/empty.html", ""); |
203
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
212 symlink("dir", "$d/dirlink"); |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
213 |
201
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
214 symlink($extfile, "$d/cached/link"); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
215 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
216 ############################################################################### |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
217 |
206
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
218 SKIP: { |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
219 skip 'cannot test under symlink', 25 if $d ne realpath($d); |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
220 |
201
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
221 like(http_get_host('s1', '/link'), qr!200 OK!, 'static (off, same uid)'); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
222 like(http_get_host('s1', '/link2'), qr!200 OK!, 'static (off, other uid)'); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
223 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
224 like(http_get_host('s1', '/on/link'), qr!403 Forbidden!, |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
225 'static (on, same uid)'); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
226 like(http_get_host('s1', '/on/link2'), qr!403 Forbidden!, |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
227 'static (on, other uid)'); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
228 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
229 like(http_get_host('s1', '/not_owner/link'), qr!200 OK!, |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
230 'static (if_not_owner, same uid)'); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
231 like(http_get_host('s1', '/not_owner/link2'), qr!403 Forbidden!, |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
232 'static (if_not_owner, other uid)'); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
233 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
234 like(http_get_host('s1', '/try_on/try'), qr/LOCAL TRY/, |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
235 'try_files (on)'); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
236 like(http_get_host('s1', '/try_not_owner/try'), qr/LOCAL TRY/, |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
237 'try_files (if_not_owner)'); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
238 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
239 like(http_get_host('s1', '/if_on/link'), qr!403 Forbidden!, |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
240 'if (on, same uid)'); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
241 like(http_get_host('s1', '/if_on/link2'), qr!403 Forbidden!, |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
242 'if (on, other uid)'); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
243 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
244 like(http_get_host('s1', '/if_not_owner/link'), qr!204 No Content!, |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
245 'if (if_not_owner, same uid)'); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
246 like(http_get_host('s1', '/if_not_owner/link2'), qr!403 Forbidden!, |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
247 'if (if_not_owner, other uid)'); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
248 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
249 like(http_get_host('s2', '/cached-off/link'), qr!200 OK!, |
202
067b6cb4793d
Tests: cleanup disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
201
diff
changeset
|
250 'open_file_cache (pass 1)'); |
201
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
251 like(http_get_host('s2', '/cached-on/link'), qr!403 Forbidden!, |
202
067b6cb4793d
Tests: cleanup disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
201
diff
changeset
|
252 'open_file_cache (pass 2)'); |
201
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
253 like(http_get_host('s2', '/cached-off/link'), qr!200 OK!, |
202
067b6cb4793d
Tests: cleanup disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
201
diff
changeset
|
254 'open_file_cache (pass 3)'); |
201
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
255 like(http_get_host('s2', '/cached-if-not-owner/link'), qr!403 Forbidden!, |
202
067b6cb4793d
Tests: cleanup disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
201
diff
changeset
|
256 'open_file_cache (pass 4)'); |
201
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
257 like(http_get_host('s2', '/cached-off/link'), qr!200 OK!, |
202
067b6cb4793d
Tests: cleanup disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
201
diff
changeset
|
258 'open_file_cache (pass 5)'); |
201
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
259 |
203
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
260 like(http_get('/complex/1/empty.html'), qr!200 OK!, 'complex root 1'); |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
261 like(http_get('/complex/2/empty.html'), qr!200 OK!, 'complex root 2'); |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
262 like(http_get('/complex/3/empty.html'), qr!200 OK!, 'complex root 3'); |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
263 |
205
606a4df68952
Tests: workaround for freebsd 8 in disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
204
diff
changeset
|
264 # workaround for freebsd 8: we use O_EXEC instead of O_SEARCH (since there |
606a4df68952
Tests: workaround for freebsd 8 in disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
204
diff
changeset
|
265 # is no O_SEARCH), and O_DIRECTORY does nothing. setting the 'x' bit |
606a4df68952
Tests: workaround for freebsd 8 in disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
204
diff
changeset
|
266 # tests to pass as openat() will correctly fail with ENOTDIR |
606a4df68952
Tests: workaround for freebsd 8 in disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
204
diff
changeset
|
267 |
606a4df68952
Tests: workaround for freebsd 8 in disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
204
diff
changeset
|
268 chmod(0700, "$d/link"); |
606a4df68952
Tests: workaround for freebsd 8 in disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
204
diff
changeset
|
269 |
207
0a9e5d753fb8
Tests: accept 404 on file link open with trailing slash.
Maxim Dounin <mdounin@mdounin.ru>
parents:
206
diff
changeset
|
270 like(http_get('/link/tail'), qr!40[34] !, 'file with trailing /, on'); |
204
d838248b643a
Tests: more disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
203
diff
changeset
|
271 like(http_get('/link/tailowner'), qr!404 !, 'file with trailing /, owner'); |
d838248b643a
Tests: more disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
203
diff
changeset
|
272 like(http_get('/link/tailoff'), qr!404 !, 'file with trailing /, off'); |
d838248b643a
Tests: more disable_symlinks tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
203
diff
changeset
|
273 |
203
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
274 like(http_get('/dirlink'), qr!404 !, 'directory without /'); |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
275 like(http_get('/dirlink/'), qr!404 !, 'directory with trailing /'); |
b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
Maxim Dounin <mdounin@mdounin.ru>
parents:
202
diff
changeset
|
276 |
206
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
277 } # SKIP: cannot test under symlink |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
278 |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
279 like(http_get('/from/wo_slash/empty.html'), qr!200 OK!, '"from=" without /'); |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
280 like(http_get('/from/with_slash/empty.html'), qr!200 OK!, '"from=" with /'); |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
281 like(http_get('/from/exact/link'), qr!200 OK!, '"from=" exact match'); |
9963da7397cc
Tests: disable_symlinks tests for the "from=" parameter.
Valentin Bartenev <ne@vbart.ru>
parents:
205
diff
changeset
|
282 |
201
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
283 ############################################################################### |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
284 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
285 sub http_get_host { |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
286 my ($host, $url) = @_; |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
287 return http(<<EOF); |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
288 GET $url HTTP/1.0 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
289 Host: $host |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
290 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
291 EOF |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
292 } |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
293 |
fc297a64142e
Tests: disable_symlinks directive tests added.
Andrey Belov <defan@nginx.com>
parents:
diff
changeset
|
294 ############################################################################### |