ILD

using curl command with webdav
作者:Yuan Jianpeng 邮箱:yuanjp89@163.com
发布时间:2025-10-21 站点:Inside Linux Development

WebDAV Web Distributed Authoring and Versioning

是一个http 扩展 (extenion),可以实现文件的上传、下载等操作。


比如创建文件夹,可以使用MKCOL。

MKCOL /pub2/folder1/folder2/ HTTP/1.1
Host: www.contoso.com
Content-Type: text/xml
Content-Length: XXX


返回

HTTP/1.1 201 Created


nginx原生支持webdav。代码:

src/http/modules/ngx_http_dav_module.c


使用curl,删除、创建文件夹:

curl -X DELETE -u 'u2232476592:pwd' 'http://192.168.3.216:5005/pool0/data/我的照片/x'

curl -X MKCOL --header "Xattr-nas-id: 123456" -u 'u2232476592:pwd' 'http://192.168.3.216:5005/pool0/data/我的照片/x'



参考:

https://developer.mozilla.org/en-US/docs/Glossary/WebDAV


https://stackoverflow.com/questions/2594880/using-curl-with-a-username-and-password


https://stackoverflow.com/questions/356705/how-to-send-a-header-using-a-http-request-through-a-curl-call


https://learn.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2003/aa142923(v=exchg.65)


Copyright © linuxdev.cc 2017-2024. Some Rights Reserved.