Mercurial > hg > nginx-tests
annotate dav.t @ 1434:fc8341cf92a3
Tests: removed ngx_parse_inet6_url() "::" test from proxy.t.
It results in WSAEADDRNOTAVAIL on win32, be the connection errors detected,
which leads to connect() alert. On other systems, connect() is successful
but it uses the default port (80), which is out of documented ports range.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 24 Jan 2019 17:05:04 +0300 |
parents | 6efe4dbf713b |
children | 144c6ce732e4 |
rev | line source |
---|---|
141
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
2 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
3 # (C) Maxim Dounin |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
4 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
5 # Tests for nginx dav module. |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
6 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
7 ############################################################################### |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
8 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
9 use warnings; |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
10 use strict; |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
11 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
12 use Test::More; |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
13 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
14 BEGIN { use FindBin; chdir($FindBin::Bin); } |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
15 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
16 use lib 'lib'; |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
17 use Test::Nginx; |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
18 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
19 ############################################################################### |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
20 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
21 select STDERR; $| = 1; |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
22 select STDOUT; $| = 1; |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
23 |
1360
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
24 my $t = Test::Nginx->new()->has(qw/http dav/)->plan(20); |
141
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
25 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
26 $t->write_file_expand('nginx.conf', <<'EOF'); |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
27 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
28 %%TEST_GLOBALS%% |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
29 |
249
6a0d934950bc
Tests: remove extra spaces in "daemon off".
Maxim Dounin <mdounin@mdounin.ru>
parents:
176
diff
changeset
|
30 daemon off; |
141
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
31 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
32 events { |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
33 } |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
34 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
35 http { |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
36 %%TEST_GLOBALS_HTTP%% |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
37 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
38 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
39 listen 127.0.0.1:8080; |
141
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
40 server_name localhost; |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
41 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
42 location / { |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
43 dav_methods PUT DELETE MKCOL COPY MOVE; |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
44 } |
1150
ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
45 |
ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
46 location /i/ { |
ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
47 alias %%TESTDIR%%/; |
ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
48 dav_methods PUT DELETE MKCOL COPY MOVE; |
ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
49 } |
141
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
50 } |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
51 } |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
52 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
53 EOF |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
54 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
55 $t->run(); |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
56 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
57 ############################################################################### |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
58 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
59 my $r; |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
60 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
61 $r = http(<<EOF . '0123456789'); |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
62 PUT /file HTTP/1.1 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
63 Host: localhost |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
64 Connection: close |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
65 Content-Length: 10 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
66 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
67 EOF |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
68 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
69 like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, 'put file'); |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
70 is(-s $t->testdir() . '/file', 10, 'put file size'); |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
71 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
72 $r = http(<<EOF); |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
73 PUT /file HTTP/1.1 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
74 Host: localhost |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
75 Connection: close |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
76 Content-Length: 0 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
77 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
78 EOF |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
79 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
80 like($r, qr/204 No Content/, 'put file again'); |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
81 unlike($r, qr/Content-Length|Transfer-Encoding/, 'no length in 204'); |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
82 is(-s $t->testdir() . '/file', 0, 'put file again size'); |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
83 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
84 $r = http(<<EOF); |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
85 DELETE /file HTTP/1.1 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
86 Host: localhost |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
87 Connection: close |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
88 Content-Length: 0 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
89 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
90 EOF |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
91 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
92 like($r, qr/204 No Content/, 'delete file'); |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
93 unlike($r, qr/Content-Length|Transfer-Encoding/, 'no length in 204'); |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
94 ok(!-f $t->testdir() . '/file', 'file deleted'); |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
95 |
154
2644bad81b0b
Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents:
141
diff
changeset
|
96 $r = http(<<EOF . '0123456789' . 'extra'); |
2644bad81b0b
Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents:
141
diff
changeset
|
97 PUT /file HTTP/1.1 |
2644bad81b0b
Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents:
141
diff
changeset
|
98 Host: localhost |
2644bad81b0b
Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents:
141
diff
changeset
|
99 Connection: close |
2644bad81b0b
Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents:
141
diff
changeset
|
100 Content-Length: 10 |
2644bad81b0b
Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents:
141
diff
changeset
|
101 |
2644bad81b0b
Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents:
141
diff
changeset
|
102 EOF |
2644bad81b0b
Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents:
141
diff
changeset
|
103 |
2644bad81b0b
Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents:
141
diff
changeset
|
104 like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, |
2644bad81b0b
Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents:
141
diff
changeset
|
105 'put file extra data'); |
2644bad81b0b
Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents:
141
diff
changeset
|
106 is(-s $t->testdir() . '/file', 10, |
2644bad81b0b
Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents:
141
diff
changeset
|
107 'put file extra data size'); |
2644bad81b0b
Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents:
141
diff
changeset
|
108 |
141
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
109 # 201 replies contain body, response should indicate it's empty |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
110 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
111 $r = http(<<EOF); |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
112 MKCOL /test/ HTTP/1.1 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
113 Host: localhost |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
114 Connection: close |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
115 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
116 EOF |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
117 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
118 like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, 'mkcol'); |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
119 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
120 $r = http(<<EOF); |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
121 COPY /test/ HTTP/1.1 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
122 Host: localhost |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
123 Destination: /test-moved/ |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
124 Connection: close |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
125 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
126 EOF |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
127 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
128 like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, 'copy dir'); |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
129 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
130 $r = http(<<EOF); |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
131 MOVE /test/ HTTP/1.1 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
132 Host: localhost |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
133 Destination: /test-moved/ |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
134 Connection: close |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
135 |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
136 EOF |
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
137 |
367
0726521e42f3
Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents:
249
diff
changeset
|
138 like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, 'move dir'); |
0726521e42f3
Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents:
249
diff
changeset
|
139 |
0726521e42f3
Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents:
249
diff
changeset
|
140 $r = http(<<EOF); |
0726521e42f3
Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents:
249
diff
changeset
|
141 COPY /file HTTP/1.1 |
0726521e42f3
Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents:
249
diff
changeset
|
142 Host: localhost |
0726521e42f3
Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents:
249
diff
changeset
|
143 Destination: /file-moved%20escape |
0726521e42f3
Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents:
249
diff
changeset
|
144 Connection: close |
0726521e42f3
Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents:
249
diff
changeset
|
145 |
0726521e42f3
Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents:
249
diff
changeset
|
146 EOF |
0726521e42f3
Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents:
249
diff
changeset
|
147 |
0726521e42f3
Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents:
249
diff
changeset
|
148 like($r, qr/204 No Content/, 'copy file escaped'); |
0726521e42f3
Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents:
249
diff
changeset
|
149 |
0726521e42f3
Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents:
249
diff
changeset
|
150 is(-s $t->testdir() . '/file-moved escape', 10, 'file copied unescaped'); |
0726521e42f3
Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents:
249
diff
changeset
|
151 |
1360
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
152 $t->write_file('file.exist', join '', (1 .. 42)); |
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
153 |
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
154 $r = http(<<EOF); |
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
155 COPY /file HTTP/1.1 |
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
156 Host: localhost |
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
157 Destination: /file.exist |
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
158 Connection: close |
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
159 |
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
160 EOF |
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
161 |
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
162 like($r, qr/204 No Content/, 'copy file overwrite'); |
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
163 |
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
164 TODO: { |
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
165 local $TODO = 'not yet' unless $t->has_version('1.15.3'); |
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
166 |
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
167 is(-s $t->testdir() . '/file.exist', 10, 'target file truncated'); |
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
168 |
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
169 } |
6efe4dbf713b
Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1150
diff
changeset
|
170 |
1150
ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
171 $r = http(<<EOF . '0123456789'); |
ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
172 PUT /i/alias HTTP/1.1 |
ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
173 Host: localhost |
ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
174 Connection: close |
ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
175 Content-Length: 10 |
ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
176 |
ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
177 EOF |
ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
178 |
ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
179 like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, 'put alias'); |
ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
180 like($r, qr!Location: http://localhost:\d+/i/alias\x0d?$!ms, 'location alias'); |
ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
181 is(-s $t->testdir() . '/alias', 10, 'put alias size'); |
ccf134a800ae
Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
182 |
141
1e1975cd25ef
Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
183 ############################################################################### |