Mercurial > hg > nginx-tests
annotate dav_utf8.t @ 1891:acbdc4dd7508
Tests: HTTP/3 add_trailer tests.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 09 May 2023 19:49:44 +0400 |
parents | 835630547d35 |
children | a095b971fbcc |
rev | line source |
---|---|
1828
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for nginx dav module with utf8 encoded names. |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 use Encode qw/ encode /; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 BEGIN { use FindBin; chdir($FindBin::Bin); } |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 use lib 'lib'; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 use Test::Nginx; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 ############################################################################### |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 select STDERR; $| = 1; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 select STDOUT; $| = 1; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 eval { require Win32API::File if $^O eq 'MSWin32'; }; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 plan(skip_all => 'Win32API::File not installed') if $@; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 my $t = Test::Nginx->new()->has(qw/http dav/)->plan(16); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 $t->write_file_expand('nginx.conf', <<'EOF'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 %%TEST_GLOBALS%% |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 daemon off; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 events { |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 } |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 http { |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 %%TEST_GLOBALS_HTTP%% |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 server { |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 listen 127.0.0.1:8080; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 server_name localhost; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 location / { |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 dav_methods PUT DELETE MKCOL COPY MOVE; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 } |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 } |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 } |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 EOF |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 $t->run(); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 ############################################################################### |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 local $TODO = 'not yet' if $^O eq 'MSWin32' and !$t->has_version('1.23.4'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 my $d = $t->testdir(); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 my $r; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 my $file = "file-%D0%BC%D0%B8"; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 my $file_path = "file-\x{043c}\x{0438}"; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 $r = http(<<EOF . '0123456789'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 PUT /$file HTTP/1.1 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 Host: localhost |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 Connection: close |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
72 Content-Length: 10 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
73 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
74 EOF |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, 'put file'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 ok(fileexists("$d/$file_path"), 'put file exist'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
78 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
79 $r = http(<<EOF); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
80 COPY /$file HTTP/1.1 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
81 Host: localhost |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
82 Destination: /$file-moved |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
83 Connection: close |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
84 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
85 EOF |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
86 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
87 like($r, qr/204 No Content/, 'copy file'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
88 ok(fileexists("$d/$file_path-moved"), 'copy file exist'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
89 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
90 $r = http(<<EOF); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
91 MOVE /$file HTTP/1.1 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
92 Host: localhost |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
93 Destination: /$file-moved |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
94 Connection: close |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
95 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
96 EOF |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
97 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
98 like($r, qr/204 No Content/, 'move file'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
99 ok(!fileexists("$d/$file_path"), 'file moved'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
100 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
101 $r = http(<<EOF); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
102 DELETE /$file-moved HTTP/1.1 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
103 Host: localhost |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
104 Connection: close |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
105 Content-Length: 0 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
106 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
107 EOF |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
108 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
109 like($r, qr/204 No Content/, 'delete file'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
110 ok(!fileexists("$d/$file_path-moved"), 'file deleted'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
111 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
112 my $dir = "dir-%D0%BC%D0%B8"; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
113 my $dir_path = "dir-\x{043c}\x{0438}"; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
114 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
115 $r = http(<<EOF); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
116 MKCOL /$dir/ HTTP/1.1 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
117 Host: localhost |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
118 Connection: close |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
119 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
120 EOF |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
121 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
122 like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, 'mkcol'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
123 ok(fileexists("$d/$dir_path"), 'mkcol exist'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
124 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
125 $r = http(<<EOF); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
126 COPY /$dir/ HTTP/1.1 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
127 Host: localhost |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
128 Destination: /$dir-moved/ |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
129 Connection: close |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
130 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
131 EOF |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
132 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
133 like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, 'copy dir'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
134 ok(fileexists("$d/$dir_path-moved"), 'copy dir exist'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
135 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
136 $r = http(<<EOF); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
137 MOVE /$dir/ HTTP/1.1 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
138 Host: localhost |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
139 Destination: /$dir-moved/ |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
140 Connection: close |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
141 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
142 EOF |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
143 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
144 like($r, qr/201 Created.*(Content-Length|\x0d\0a0\x0d\x0a)/ms, 'move dir'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
145 ok(!fileexists("$d/$dir_path"), 'dir moved'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
146 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
147 $r = http(<<EOF); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
148 DELETE /$dir-moved/ HTTP/1.1 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
149 Host: localhost |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
150 Connection: close |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
151 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
152 EOF |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
153 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
154 unlike($r, qr/200 OK.*Content-Length|Transfer-Encoding/ms, 'delete dir'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
155 ok(!fileexists("$d/$dir_path-moved"), 'dir deleted'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
156 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
157 ############################################################################### |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
158 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
159 sub fileexists { |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
160 my ($path) = @_; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
161 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
162 return -e $path if $^O ne 'MSWin32'; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
163 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
164 $path = encode("UTF-16LE", $path . "\0"); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
165 my $attr = Win32API::File::GetFileAttributesW($path); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
166 return 0 if $attr == Win32API::File::INVALID_HANDLE_VALUE(); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
167 return $attr; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
168 } |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
169 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
170 ############################################################################### |