Mercurial > hg > nginx-tests
comparison dav.t @ 1536:0ce1c9516764
Tests: dav.t MKCOL test for trailing slash in Location (if any).
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 23 Dec 2019 19:38:49 +0300 |
parents | 144c6ce732e4 |
children | c49e5ca1d840 |
comparison
equal
deleted
inserted
replaced
1535:144c6ce732e4 | 1536:0ce1c9516764 |
---|---|
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(20); | 24 my $t = Test::Nginx->new()->has(qw/http dav/)->plan(21); |
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 |
36 %%TEST_GLOBALS_HTTP%% | 36 %%TEST_GLOBALS_HTTP%% |
37 | 37 |
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 | |
42 absolute_redirect off; | |
41 | 43 |
42 location / { | 44 location / { |
43 dav_methods PUT DELETE MKCOL COPY MOVE; | 45 dav_methods PUT DELETE MKCOL COPY MOVE; |
44 } | 46 } |
45 | 47 |
115 | 117 |
116 EOF | 118 EOF |
117 | 119 |
118 like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, 'mkcol'); | 120 like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, 'mkcol'); |
119 | 121 |
122 TODO: { | |
123 local $TODO = 'not yet' unless $t->has_version('1.17.7'); | |
124 | |
125 like($r, qr!(?(?{ $r =~ /Location/ })Location: /test/)!, 'mkcol location'); | |
126 | |
127 } | |
128 | |
120 $r = http(<<EOF); | 129 $r = http(<<EOF); |
121 COPY /test/ HTTP/1.1 | 130 COPY /test/ HTTP/1.1 |
122 Host: localhost | 131 Host: localhost |
123 Destination: /test-moved/ | 132 Destination: /test-moved/ |
124 Connection: close | 133 Connection: close |
168 Content-Length: 10 | 177 Content-Length: 10 |
169 | 178 |
170 EOF | 179 EOF |
171 | 180 |
172 like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, 'put alias'); | 181 like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, 'put alias'); |
173 like($r, qr!Location: http://localhost:\d+/i/alias\x0d?$!ms, 'location alias'); | 182 like($r, qr!Location: /i/alias\x0d?$!ms, 'location alias'); |
174 is(-s $t->testdir() . '/alias', 10, 'put alias size'); | 183 is(-s $t->testdir() . '/alias', 10, 'put alias size'); |
175 | 184 |
176 ############################################################################### | 185 ############################################################################### |