我的想法是LOCK
在 apache/WebDAV 服务器上创建一个文件,在服务器PUT
上更新它的版本,然后在UNLOCK
它之后。
我刚刚用尸体尝试了以下操作:
- 创建一个
A.txt
包含内容的文件a file
GET
A.txt
产生的文件a file
- 编辑
A.txt
并updated file
保存(在尸体中) GET
产生的文件A.txt
仍然产生a file
- 尸体中的关闭编辑(VIM)
GET
A.txt
产生的文件updated file
我猜在内部 cadaver LOCK
s 文件,GET
s 它并在本地更改它。然后它PUT
就是UNLOCK
它。
问题:我怎样才能用 curl 做到这一点?
问题:当连接速度很慢并且我PUT
为一个尚未完全上传的文件做一个时,我只得到尚未上传的部分。我想买旧的,只要新的不完整。
尝试:我尝试了以下手动锁定文件(即使用 cURL):
curl -v -X LOCK --user "user:password" http://myServer/newFile
我得到的是:
* About to connect() to myServer port 80 (#0)
* Trying xx.xx.xxx.xxx... connected
* Connected to myServer (xx.xx.xxx.xxx) port 80 (#0)
* Server auth using Basic with user 'user'
> LOCK /newFile HTTP/1.1
> Authorization: Basic xxxxxxxxxxxxxxxxx
> User-Agent: curl/7.21.6 (x86_64-pc-linux-gnu) libcurl/7.21.6 OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 librtmp/2.3
> Host: myServer
> Accept: */*
>
< HTTP/1.1 400 Bad Request
< Date: Wed, 02 May 2012 15:20:55 GMT
< Server: Apache/2.2.3 (CentOS)
< Content-Length: 226
< Connection: close
< Content-Type: text/html; charset=iso-8859-1
<
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
</body></html>
* Closing connection #0
查看 apache 日志文件,我发现:
[Wed May 02 15:20:55 2012] [error] [client xx.xx.xxx.xxx] The lock refresh for /newFile failed because no lock tokens were specified in an "If:" header. [400, #0]
[Wed May 02 15:20:55 2012] [error] [client xx.xx.xxx.xxx] (20)Not a directory: No locktokens were specified in the "If:" header, so the refresh could not be performed. [400, #103]
感谢您的任何提示!
更新:我添加了我的问题描述..干杯!