Mercurial > hg > nginx-tests
comparison dav.t @ 1150:ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 21 Mar 2017 15:42:21 +0300 |
parents | 882267679006 |
children | 6efe4dbf713b |
comparison
equal
deleted
inserted
replaced
1149:b1c2857d2e97 | 1150:ccf134a800ae |
---|---|
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 dav/)->plan(15); | 24 my $t = Test::Nginx->new()->has(qw/http dav/)->plan(18); |
25 | 25 |
26 $t->write_file_expand('nginx.conf', <<'EOF'); | 26 $t->write_file_expand('nginx.conf', <<'EOF'); |
27 | 27 |
28 %%TEST_GLOBALS%% | 28 %%TEST_GLOBALS%% |
29 | 29 |
38 server { | 38 server { |
39 listen 127.0.0.1:8080; | 39 listen 127.0.0.1:8080; |
40 server_name localhost; | 40 server_name localhost; |
41 | 41 |
42 location / { | 42 location / { |
43 dav_methods PUT DELETE MKCOL COPY MOVE; | |
44 } | |
45 | |
46 location /i/ { | |
47 alias %%TESTDIR%%/; | |
43 dav_methods PUT DELETE MKCOL COPY MOVE; | 48 dav_methods PUT DELETE MKCOL COPY MOVE; |
44 } | 49 } |
45 } | 50 } |
46 } | 51 } |
47 | 52 |
142 | 147 |
143 like($r, qr/204 No Content/, 'copy file escaped'); | 148 like($r, qr/204 No Content/, 'copy file escaped'); |
144 | 149 |
145 is(-s $t->testdir() . '/file-moved escape', 10, 'file copied unescaped'); | 150 is(-s $t->testdir() . '/file-moved escape', 10, 'file copied unescaped'); |
146 | 151 |
152 $r = http(<<EOF . '0123456789'); | |
153 PUT /i/alias HTTP/1.1 | |
154 Host: localhost | |
155 Connection: close | |
156 Content-Length: 10 | |
157 | |
158 EOF | |
159 | |
160 like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, 'put alias'); | |
161 like($r, qr!Location: http://localhost:\d+/i/alias\x0d?$!ms, 'location alias'); | |
162 is(-s $t->testdir() . '/alias', 10, 'put alias size'); | |
163 | |
147 ############################################################################### | 164 ############################################################################### |