Mercurial > hg > nginx-tests
annotate dav_utf8.t @ 1990:85d88cd5091c
Tests: SSI include stub tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 04 Jul 2024 17:42:55 +0300 |
parents | a095b971fbcc |
children |
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 my $d = $t->testdir(); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 my $r; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 my $file = "file-%D0%BC%D0%B8"; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 my $file_path = "file-\x{043c}\x{0438}"; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 $r = http(<<EOF . '0123456789'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 PUT /$file HTTP/1.1 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 Host: localhost |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 Connection: close |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 Content-Length: 10 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
72 EOF |
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 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
|
75 ok(fileexists("$d/$file_path"), 'put file exist'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 $r = http(<<EOF); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
78 COPY /$file HTTP/1.1 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
79 Host: localhost |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
80 Destination: /$file-moved |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
81 Connection: close |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
82 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
83 EOF |
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 like($r, qr/204 No Content/, 'copy file'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
86 ok(fileexists("$d/$file_path-moved"), 'copy file exist'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
87 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
88 $r = http(<<EOF); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
89 MOVE /$file HTTP/1.1 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
90 Host: localhost |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
91 Destination: /$file-moved |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
92 Connection: close |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
93 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
94 EOF |
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 like($r, qr/204 No Content/, 'move file'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
97 ok(!fileexists("$d/$file_path"), 'file moved'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
98 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
99 $r = http(<<EOF); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
100 DELETE /$file-moved HTTP/1.1 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
101 Host: localhost |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
102 Connection: close |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
103 Content-Length: 0 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
104 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
105 EOF |
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 like($r, qr/204 No Content/, 'delete file'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
108 ok(!fileexists("$d/$file_path-moved"), 'file deleted'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
109 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
110 my $dir = "dir-%D0%BC%D0%B8"; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
111 my $dir_path = "dir-\x{043c}\x{0438}"; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
112 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
113 $r = http(<<EOF); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
114 MKCOL /$dir/ HTTP/1.1 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
115 Host: localhost |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
116 Connection: close |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
117 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
118 EOF |
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 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
|
121 ok(fileexists("$d/$dir_path"), 'mkcol exist'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
122 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
123 $r = http(<<EOF); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
124 COPY /$dir/ HTTP/1.1 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
125 Host: localhost |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
126 Destination: /$dir-moved/ |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
127 Connection: close |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
128 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
129 EOF |
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 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
|
132 ok(fileexists("$d/$dir_path-moved"), 'copy dir exist'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
133 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
134 $r = http(<<EOF); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
135 MOVE /$dir/ HTTP/1.1 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
136 Host: localhost |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
137 Destination: /$dir-moved/ |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
138 Connection: close |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
139 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
140 EOF |
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 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
|
143 ok(!fileexists("$d/$dir_path"), 'dir moved'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
144 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
145 $r = http(<<EOF); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
146 DELETE /$dir-moved/ HTTP/1.1 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
147 Host: localhost |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
148 Connection: close |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
149 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
150 EOF |
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 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
|
153 ok(!fileexists("$d/$dir_path-moved"), 'dir deleted'); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
154 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
155 ############################################################################### |
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 sub fileexists { |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
158 my ($path) = @_; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
159 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
160 return -e $path if $^O ne 'MSWin32'; |
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 $path = encode("UTF-16LE", $path . "\0"); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
163 my $attr = Win32API::File::GetFileAttributesW($path); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
164 return 0 if $attr == Win32API::File::INVALID_HANDLE_VALUE(); |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
165 return $attr; |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
166 } |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
167 |
835630547d35
Tests: dav tests with UTF-8.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
168 ############################################################################### |