yuq
WebDAV COPY and MOVE problem
February 18, 2014 05:49AM
Hello,

I configure NGINX to be a WebDAV server:

server {
listen 8283;
server_name 127.0.0.1;

root /home;

charset utf-8;
create_full_put_path on;
client_max_body_size 4g;
client_body_timeout 600s;
client_body_buffer_size 512k;
# for we can mv uploaded files in the same partition
client_body_temp_path /home/_tmp_/nginx 1 2;

dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
dav_access user:rw group:rw all:r;

location / {
deny all;
}

location ~ ^/users/(\w+)(/.*)?$ {
alias /home/$1$2;
auth_basic "emNAS";
auth_basic_user_file /opt/emnas/etc/webdav/$1.ht;
autoindex on;
}
}

I tested COPY and MOVE not work. Track the code with GDB, the problem
is in function ngx_http_dav_copy_move_handler() which calls ngx_http_map_uri_to_path()
to map destination URI to destination path. But it map destination URI to source path.
So the MOVE does nothing, the COPY report file exists error.

For example,
MOVE http://localhost:8283/users/admin/aaa to http://localhost:8283/users/admin/bbb
results an FS op
RENAME /home/admin/aaa to /home/admin/aaa
which does nothing.

The wrong path from correct URI is generated by ngx_http_script_run() which execute
some code from configuration.
I'm not familiar with NGINX, so I don't know where is the cause of this problem.
Is it an NGINX bug or my wrong configuration?

I tested NGINX 1.1.19, 1.2.1, 1.4.5, 1.5.10. They all have the problem.

Regards,
Qiang
yuq
Re: WebDAV COPY and MOVE problem
February 18, 2014 09:05PM
A little progress, this configuration is OK:
server {
listen 8283;
server_name 127.0.0.1;

root /home;

charset utf-8;
create_full_put_path on;
client_max_body_size 4g;
client_body_timeout 600s;
client_body_buffer_size 512k;
# for we can mv uploaded files in the same partition
client_body_temp_path /home/_tmp_/nginx 1 2;

dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
dav_access user:rw group:rw all:r;

location / {
autoindex on;
}
}

ngx_http_dav_copy_move_handler() calls ngx_http_map_uri_to_path() first time
to convert source URI to source file path, then second time for destination URI.
It seems the previous regex capture result is not cleared in the second run
of ngx_http_map_uri_to_path().
yuq
Re: WebDAV COPY and MOVE problem
February 19, 2014 10:03PM
Reported a BUG to TRAC:
http://trac.nginx.org/nginx/ticket/510
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 173
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready