annotate dav.t @ 1541:b9de5364dfc9

Tests: unbreak dav tests on Perl < 5.12.
author Sergey Kandaurov <pluknet@nginx.com>
date Sat, 28 Dec 2019 19:22:28 +0300
parents c49e5ca1d840
children 0d8531f744bc
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
1538
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
24 my $t = Test::Nginx->new()->has(qw/http dav/)->plan(27);
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
141
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
111 # 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
112
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
113 $r = http(<<EOF);
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
114 MKCOL /test/ HTTP/1.1
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
115 Host: localhost
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
116 Connection: close
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 EOF
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 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
121
1541
b9de5364dfc9 Tests: unbreak dav tests on Perl < 5.12.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1538
diff changeset
122 SKIP: {
b9de5364dfc9 Tests: unbreak dav tests on Perl < 5.12.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1538
diff changeset
123 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
124
1536
0ce1c9516764 Tests: dav.t MKCOL test for trailing slash in Location (if any).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1535
diff changeset
125 TODO: {
0ce1c9516764 Tests: dav.t MKCOL test for trailing slash in Location (if any).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1535
diff changeset
126 local $TODO = 'not yet' unless $t->has_version('1.17.7');
0ce1c9516764 Tests: dav.t MKCOL test for trailing slash in Location (if any).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1535
diff changeset
127
0ce1c9516764 Tests: dav.t MKCOL test for trailing slash in Location (if any).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1535
diff changeset
128 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
129
0ce1c9516764 Tests: dav.t MKCOL test for trailing slash in Location (if any).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1535
diff changeset
130 }
0ce1c9516764 Tests: dav.t MKCOL test for trailing slash in Location (if any).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1535
diff changeset
131
1541
b9de5364dfc9 Tests: unbreak dav tests on Perl < 5.12.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1538
diff changeset
132 }
b9de5364dfc9 Tests: unbreak dav tests on Perl < 5.12.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1538
diff changeset
133
141
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
134 $r = http(<<EOF);
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
135 COPY /test/ HTTP/1.1
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
136 Host: localhost
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
137 Destination: /test-moved/
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
138 Connection: close
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
139
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
140 EOF
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
141
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
142 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
143
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
144 $r = http(<<EOF);
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
145 MOVE /test/ HTTP/1.1
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
146 Host: localhost
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
147 Destination: /test-moved/
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
148 Connection: close
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
149
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
150 EOF
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
151
367
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
152 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
153
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
154 $r = http(<<EOF);
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
155 COPY /file HTTP/1.1
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
156 Host: localhost
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
157 Destination: /file-moved%20escape
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
158 Connection: close
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
159
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
160 EOF
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
161
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
162 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
163 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
164
1360
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
165 $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
166
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
167 $r = http(<<EOF);
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
168 COPY /file HTTP/1.1
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
169 Host: localhost
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
170 Destination: /file.exist
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
171 Connection: close
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
172
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
173 EOF
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
174
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
175 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
176 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
177
1150
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
178 $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
179 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
180 Host: localhost
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
181 Connection: close
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
182 Content-Length: 10
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
183
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
184 EOF
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
185
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
186 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
187 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
188 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
189
1538
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
190 # request methods with unsupported request body
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
191
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
192 $r = http(<<EOF . '0123456789');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
193 MKCOL /test/ HTTP/1.1
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
194 Host: localhost
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
195 Connection: close
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
196 Content-Length: 10
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
197
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
198 EOF
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
199
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
200 like($r, qr/415 Unsupported/, 'mkcol body');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
201
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
202 $r = http(<<EOF . '0123456789');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
203 COPY /file HTTP/1.1
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
204 Host: localhost
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
205 Destination: /file.exist
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
206 Connection: close
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
207 Content-Length: 10
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
208
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
209 EOF
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
210
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
211 like($r, qr/415 Unsupported/, 'copy body');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
212
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 $r = http(<<EOF . '0123456789');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
215 DELETE /file HTTP/1.1
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
216 Host: localhost
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
217 Connection: close
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
218 Content-Length: 10
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
219
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
220 EOF
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
221
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
222 like($r, qr/415 Unsupported/, 'delete body');
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 TODO: {
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
225 local $TODO = 'not yet' unless $t->has_version('1.17.7');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
226
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
227 $r = http(<<EOF);
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
228 MKCOL /test/ HTTP/1.1
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
229 Host: localhost
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
230 Connection: close
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
231 Transfer-Encoding: chunked
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
232
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
233 a
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
234 0123456789
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
235 0
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
236
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
237 EOF
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
238
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
239 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
240
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
241 $r = http(<<EOF);
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
242 COPY /file HTTP/1.1
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
243 Host: localhost
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
244 Destination: /file.exist
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
245 Connection: close
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
246 Transfer-Encoding: chunked
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
247
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
248 a
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
249 0123456789
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
250 0
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
251
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
252 EOF
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
253
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
254 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
255
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
256 $r = http(<<EOF);
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
257 DELETE /file HTTP/1.1
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
258 Host: localhost
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
259 Connection: close
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
260 Transfer-Encoding: chunked
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
261
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
262 a
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
263 0123456789
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
264 0
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
265
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
266 EOF
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
267
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
268 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
269
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
270 }
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
271
141
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
272 ###############################################################################