annotate dav.t @ 1538:c49e5ca1d840

Tests: dav tests with unsupported request body.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 26 Dec 2019 18:55:56 +0300
parents 0ce1c9516764
children b9de5364dfc9
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
1536
0ce1c9516764 Tests: dav.t MKCOL test for trailing slash in Location (if any).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1535
diff changeset
122 TODO: {
0ce1c9516764 Tests: dav.t MKCOL test for trailing slash in Location (if any).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1535
diff changeset
123 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
124
0ce1c9516764 Tests: dav.t MKCOL test for trailing slash in Location (if any).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1535
diff changeset
125 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
126
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
141
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
129 $r = http(<<EOF);
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
130 COPY /test/ HTTP/1.1
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
131 Host: localhost
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
132 Destination: /test-moved/
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
133 Connection: close
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
134
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
135 EOF
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
136
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
137 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
138
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 MOVE /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
367
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
147 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
148
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
149 $r = http(<<EOF);
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
150 COPY /file HTTP/1.1
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
151 Host: localhost
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
152 Destination: /file-moved%20escape
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
153 Connection: close
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
154
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
155 EOF
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
156
0726521e42f3 Tests: added tests for escaped and unsafe URIs.
Sergey Kandaurov <pluknet@nginx.com>
parents: 249
diff changeset
157 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
158 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
159
1360
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
160 $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
161
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
162 $r = http(<<EOF);
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
163 COPY /file HTTP/1.1
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
164 Host: localhost
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
165 Destination: /file.exist
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
166 Connection: close
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
167
6efe4dbf713b Tests: added dav copy test with existing destination file.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1150
diff changeset
168 EOF
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 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
171 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
172
1150
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
173 $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
174 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
175 Host: localhost
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
176 Connection: close
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
177 Content-Length: 10
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 EOF
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
180
ccf134a800ae Tests: added Location tests with alias for dav and static modules.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
181 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
182 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
183 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
184
1538
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
185 # request methods with unsupported request body
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
186
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
187 $r = http(<<EOF . '0123456789');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
188 MKCOL /test/ HTTP/1.1
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
189 Host: localhost
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
190 Connection: close
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
191 Content-Length: 10
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
192
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
193 EOF
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
194
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
195 like($r, qr/415 Unsupported/, 'mkcol 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 COPY /file 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 Destination: /file.exist
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
201 Connection: close
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
202 Content-Length: 10
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
203
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
204 EOF
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
205
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
206 like($r, qr/415 Unsupported/, 'copy body');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
207
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 $r = http(<<EOF . '0123456789');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
210 DELETE /file HTTP/1.1
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
211 Host: localhost
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
212 Connection: close
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
213 Content-Length: 10
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
214
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
215 EOF
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
216
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
217 like($r, qr/415 Unsupported/, 'delete body');
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
218
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
219 TODO: {
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
220 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
221
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
222 $r = http(<<EOF);
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
223 MKCOL /test/ HTTP/1.1
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
224 Host: localhost
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
225 Connection: close
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
226 Transfer-Encoding: chunked
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 a
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
229 0123456789
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
230 0
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
231
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
232 EOF
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 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
235
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
236 $r = http(<<EOF);
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
237 COPY /file HTTP/1.1
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
238 Host: localhost
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
239 Destination: /file.exist
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
240 Connection: close
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
241 Transfer-Encoding: chunked
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
242
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
243 a
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
244 0123456789
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
245 0
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
246
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
247 EOF
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 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
250
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
251 $r = http(<<EOF);
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
252 DELETE /file HTTP/1.1
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
253 Host: localhost
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
254 Connection: close
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
255 Transfer-Encoding: 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 a
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
258 0123456789
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
259 0
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
260
c49e5ca1d840 Tests: dav tests with unsupported request body.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1536
diff changeset
261 EOF
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 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
264
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
141
1e1975cd25ef Tests: error_page and return related tests, dav tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
267 ###############################################################################