[nginx-tests] Tests: tests for DAV COPY with alias.
Maxim Dounin
mdounin at mdounin.ru
Tue Mar 31 04:02:53 UTC 2026
details: http://freenginx.org/hg/nginx-tests/rev/1b153e4703cf
branches:
changeset: 2046:1b153e4703cf
user: Maxim Dounin <mdounin at mdounin.ru>
date: Tue Mar 31 07:01:04 2026 +0300
description:
Tests: tests for DAV COPY with alias.
diffstat:
dav.t | 48 +++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 47 insertions(+), 1 deletions(-)
diffs (72 lines):
diff --git a/dav.t b/dav.t
--- a/dav.t
+++ b/dav.t
@@ -21,7 +21,7 @@ use Test::Nginx;
select STDERR; $| = 1;
select STDOUT; $| = 1;
-my $t = Test::Nginx->new()->has(qw/http dav/)->plan(28);
+my $t = Test::Nginx->new()->has(qw/http dav/)->plan(31);
$t->write_file_expand('nginx.conf', <<'EOF');
@@ -180,6 +180,8 @@ EOF
like($r, qr/204 No Content/, 'copy file overwrite');
is(-s $t->testdir() . '/file.exist', 10, 'target file truncated');
+# tests in location with alias
+
$r = http(<<EOF . '0123456789');
PUT /i/alias HTTP/1.1
Host: localhost
@@ -192,6 +194,50 @@ like($r, qr/201 Created.*(Content-Length
like($r, qr!Location: /i/alias\x0d?$!ms, 'location alias');
is(-s $t->testdir() . '/alias', 10, 'put alias size');
+$r = http(<<EOF);
+COPY /i/file HTTP/1.1
+Host: localhost
+Connection: close
+Destination: /i/file.alias
+
+EOF
+
+like($r, qr/204 No Content/, 'copy alias');
+
+TODO: {
+local $TODO = 'not yet' unless $t->has_version('1.29.7');
+
+$r = http(<<EOF);
+COPY /i/file HTTP/1.1
+Host: localhost
+Connection: close
+Destination: /x/file.alias
+
+EOF
+
+like($r, qr/400 Bad Request/, 'copy alias outside');
+
+}
+
+TODO: {
+local $TODO = 'not yet', $t->todo_alerts()
+ unless $t->has_version('1.29.7');
+todo_skip 'leaves coredump', 1
+ unless $t->has_version('1.29.7')
+ or $ENV{TEST_NGINX_UNSAFE};
+
+$r = http(<<EOF);
+COPY /i/file HTTP/1.1
+Host: localhost
+Connection: close
+Destination: /x
+
+EOF
+
+like($r, qr/400 Bad Request/, 'copy alias too short');
+
+}
+
# request methods with unsupported request body
$r = http(<<EOF . '0123456789');
More information about the nginx-devel
mailing list