annotate dav.t @ 1982:fb25cbe9d4ec default tip

Tests: explicit Valgrind support. Valgrind logging is done to a separate file, as it is not able to follow stderr redirection within nginx or append to a file without corrupting it. Further, Valgrind logging seems to interfere with error suppression in tests, and catches various startup errors and warnings, so the log is additionally filtered. Since startup under Valgrind can be really slow, timeout in waitforfile() was changed to 10 seconds. Prodded by Robert Mueller.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 31 May 2024 06:23:00 +0300
parents 2a0a6035a1af
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
1691
0d8531f744bc Tests: added Location header escaping tests (ticket #882).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1541
diff changeset
24 my $t = Test::Nginx->new()->has(qw/http dav/)->plan(28);
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
1536
0ce1c9516764 Tests: dav.t MKCOL test for trailing slash in Location (if any).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1535
diff changeset
42 absolute_redirect off;
0ce1c9516764 Tests: dav.t MKCOL test for trailing slash in Location (if any).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1535
diff changeset
43
141
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
44 location / {
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
45 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
46 }
1150
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
47
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
48 location /i/ {
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
49 alias %%TESTDIR%%/;
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
50 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
51 }
141
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 }
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 EOF
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 $t->run();
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 ###############################################################################
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 my $r;
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
62
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
63 $r = http(<<EOF . '0123456789');
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
64 PUT /file HTTP/1.1
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
65 Host: localhost
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
66 Connection: close
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
67 Content-Length: 10
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 EOF
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
70
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
71 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
72 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
73
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
74 $r = http(<<EOF);
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
75 PUT /file HTTP/1.1
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
76 Host: localhost
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
77 Connection: close
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
78 Content-Length: 0
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 EOF
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
81
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
82 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
83 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
84 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
85
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
86 $r = http(<<EOF);
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
87 DELETE /file HTTP/1.1
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
88 Host: localhost
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
89 Connection: close
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
90 Content-Length: 0
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 EOF
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
93
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
94 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
95 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
96 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
97
154
2644bad81b0b Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents: 141
diff changeset
98 $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
99 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
100 Host: localhost
2644bad81b0b Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents: 141
diff changeset
101 Connection: close
2644bad81b0b Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents: 141
diff changeset
102 Content-Length: 10
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 EOF
2644bad81b0b Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents: 141
diff changeset
105
2644bad81b0b Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents: 141
diff changeset
106 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
107 'put file extra data');
2644bad81b0b Tests: add test for preread body and extra data problem.
Maxim Dounin <mdounin@mdounin.ru>
parents: 141
diff changeset
108 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
109 '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
110
1691
0d8531f744bc Tests: added Location header escaping tests (ticket #882).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1541
diff changeset
111 $r = http(<<EOF . '0123456789');
0d8531f744bc Tests: added Location header escaping tests (ticket #882).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1541
diff changeset
112 PUT /file%20sp HTTP/1.1
0d8531f744bc Tests: added Location header escaping tests (ticket #882).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1541
diff changeset
113 Host: localhost
0d8531f744bc Tests: added Location header escaping tests (ticket #882).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1541
diff changeset
114 Connection: close
0d8531f744bc Tests: added Location header escaping tests (ticket #882).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1541
diff changeset
115 Content-Length: 10
0d8531f744bc Tests: added Location header escaping tests (ticket #882).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1541
diff changeset
116
0d8531f744bc Tests: added Location header escaping tests (ticket #882).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1541
diff changeset
117 EOF
0d8531f744bc Tests: added Location header escaping tests (ticket #882).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1541
diff changeset
118
0d8531f744bc Tests: added Location header escaping tests (ticket #882).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1541
diff changeset
119 like($r, qr!Location: /file%20sp\x0d?$!ms, 'put file escaped');
0d8531f744bc Tests: added Location header escaping tests (ticket #882).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1541
diff changeset
120
141
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
121 # 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
122
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
123 $r = http(<<EOF);
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
124 MKCOL /test/ HTTP/1.1
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
125 Host: localhost
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
126 Connection: close
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 EOF
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 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
131
1541
b9de5364dfc9 Tests: unbreak dav tests on Perl < 5.12.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1538
diff changeset
132 SKIP: {
b9de5364dfc9 Tests: unbreak dav tests on Perl < 5.12.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1538
diff changeset
133 skip 'perl too old', 1 if !$^V or $^V lt v5.12.0;
b9de5364dfc9 Tests: unbreak dav tests on Perl < 5.12.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1538
diff changeset
134
1536
0ce1c9516764 Tests: dav.t MKCOL test for trailing slash in Location (if any).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1535
diff changeset
135 like($r, qr!(?(?{ $r =~ /Location/ })Location: /test/)!, 'mkcol location');
0ce1c9516764 Tests: dav.t MKCOL test for trailing slash in Location (if any).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1535
diff changeset
136
0ce1c9516764 Tests: dav.t MKCOL test for trailing slash in Location (if any).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1535
diff changeset
137 }
0ce1c9516764 Tests: dav.t MKCOL test for trailing slash in Location (if any).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1535
diff changeset
138
141
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
139 $r = http(<<EOF);
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
140 COPY /test/ HTTP/1.1
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
141 Host: localhost
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
142 Destination: /test-moved/
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
143 Connection: close
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
144
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
145 EOF
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
146
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
147 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
148
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
149 $r = http(<<EOF);
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
150 MOVE /test/ HTTP/1.1
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
151 Host: localhost
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
152 Destination: /test-moved/
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
153 Connection: close
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
154
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
155 EOF
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
156
367
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
157 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
158
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
159 $r = http(<<EOF);
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
160 COPY /file HTTP/1.1
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
161 Host: localhost
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
162 Destination: /file-moved%20escape
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
163 Connection: close
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
164
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
165 EOF
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
166
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
167 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
168 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
169
1360
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
170 $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
171
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
172 $r = http(<<EOF);
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
173 COPY /file HTTP/1.1
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
174 Host: localhost
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
175 Destination: /file.exist
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
176 Connection: close
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
177
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
178 EOF
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
179
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
180 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
181 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
182
1150
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
183 $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
184 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
185 Host: localhost
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
186 Connection: close
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
187 Content-Length: 10
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
188
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
189 EOF
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
190
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
191 like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, 'put alias');
1536
0ce1c9516764 Tests: dav.t MKCOL test for trailing slash in Location (if any).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1535
diff changeset
192 like($r, qr!Location: /i/alias\x0d?$!ms, 'location alias');
1150
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
193 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
194
1538
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
195 # request methods with unsupported request body
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
196
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
197 $r = http(<<EOF . '0123456789');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
198 MKCOL /test/ HTTP/1.1
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
199 Host: localhost
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
200 Connection: close
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
201 Content-Length: 10
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
202
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
203 EOF
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
204
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
205 like($r, qr/415 Unsupported/, 'mkcol body');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
206
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
207 $r = http(<<EOF . '0123456789');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
208 COPY /file HTTP/1.1
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
209 Host: localhost
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
210 Destination: /file.exist
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
211 Connection: close
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
212 Content-Length: 10
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
213
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
214 EOF
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
215
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
216 like($r, qr/415 Unsupported/, 'copy body');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
217
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
218 $r = http(<<EOF . '0123456789');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
219 DELETE /file HTTP/1.1
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
220 Host: localhost
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
221 Connection: close
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
222 Content-Length: 10
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
223
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
224 EOF
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
225
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
226 like($r, qr/415 Unsupported/, 'delete body');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
227
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
228 $r = http(<<EOF);
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
229 MKCOL /test/ HTTP/1.1
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
230 Host: localhost
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
231 Connection: close
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
232 Transfer-Encoding: chunked
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
233
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
234 a
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
235 0123456789
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
236 0
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
237
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
238 EOF
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
239
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
240 like($r, qr/415 Unsupported/, 'mkcol body chunked');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
241
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
242 $r = http(<<EOF);
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
243 COPY /file HTTP/1.1
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
244 Host: localhost
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
245 Destination: /file.exist
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
246 Connection: close
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
247 Transfer-Encoding: chunked
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
248
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
249 a
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
250 0123456789
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
251 0
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
252
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
253 EOF
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
254
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
255 like($r, qr/415 Unsupported/, 'copy body chunked');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
256
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
257 $r = http(<<EOF);
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
258 DELETE /file HTTP/1.1
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
259 Host: localhost
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
260 Connection: close
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
261 Transfer-Encoding: chunked
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
262
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
263 a
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
264 0123456789
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
265 0
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
266
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
267 EOF
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
268
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
269 like($r, qr/415 Unsupported/, 'delete body chunked');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
270
141
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
271 ###############################################################################