WebDAV:客户端可以修改文件的 mtime 吗?
是一个 WebDAV 客户端,根据 RFC,能够更新文件的修改日期时间戳。 WebDAV 将此列为“getlastmodified”属性。 在移动文件时,能够对文件执行 utime() 非常重要,因为我将 mtime 视为基本的文件元数据。但是,例如,使用 cadaver 执行 propset(我将其视为 WebDAV 的一种参考实现),它不断地将 getlastmodifed 属性映射到其自己的命名空间中,从而将调用引导远离实际的磁盘文件时间戳,该时间戳可以通过以下方式更新utime...
由 cadaver 发送的示例 PROPPATCH 请求:
<D:propertyupdate xmlns:D="DAV:">
<D:set>
<D:prop>
<DAV:getlastmodified xmlns="http://webdav.org/cadaver/custom-properties/">Sun, 06 Nov 1994 08:49:37 GMT</DAV:getlastmodified>
</D:prop>
</D:set>
</D:propertyupdate>
我有一个正在运行的服务器,它将更新 getlastmodifed 属性,只要它没有映射到不同的命名空间...
Is a WebDAV client, per RFC, able to update the modification-date timestamp of a file. WebDAV lists this as the "getlastmodified" property.
Being able to do a utime() on files is quite important when moving files as I regard mtime as essential file metadata. But for example doing a propset with cadaver (which I regard as a kind of reference implementation of WebDAV) it constantly maps the getlastmodifed property into its own namespace, thus directing the call away from the actual on-disk file timestamo which could be updated via utime...
Example PROPPATCH request sent by cadaver:
<D:propertyupdate xmlns:D="DAV:">
<D:set>
<D:prop>
<DAV:getlastmodified xmlns="http://webdav.org/cadaver/custom-properties/">Sun, 06 Nov 1994 08:49:37 GMT</DAV:getlastmodified>
</D:prop>
</D:set>
</D:propertyupdate>
I've got a server running which would update the getlastmodifed property, if only it wasn't mapped into a different namespace...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在我看来,您已经回答了自己的问题:
如果您有一个客户端发送了具有正确命名空间的 PROPPATCH,那么您就不会遇到此问题。也许尝试修补 cadaver,或者至少弄清楚您要使用的 DAV 客户端是否表现出此行为。
It sounds to me like you have answered your own question:
If you had a client that sent a PROPPATCH with the correct namespace then you wouldn't have this issue. Maybe try patching cadaver, or at least work out if the DAV client you are going to use exhibits this behavior.
我使用 mydav.php 作为 webdav 服务器,使用 webdrive 作为 webdav 客户端(在设置中:设置文件上传后修改时间以保留日期/时间)。
mydav.php:
https://code.google.com/p/mydav/
网络驱动器:
http://www.webdrive.com/products/webdrive/index.html
I use mydav.php as webdav server, and webdrive as webdav client(in settings: Set files modified time after upload to preserve date/time).
mydav.php:
https://code.google.com/p/mydav/
webdrive:
http://www.webdrive.com/products/webdrive/index.html
DAV:getlastmodified
属性在普通 WebDAV 服务器上是只读的。但是,如果您PUT
或POST
文件,它会被修改。如果您想稍后修改它,请在服务器中实现一些功能,例如支持PROPSET
到lastmodified
(注意缺少的 get),它会执行utime()< /code> 调用可能是一种选择。
例如 ownCloud WebDAV 服务器就是这样做的。
The
DAV:getlastmodified
property is read only on usual WebDAV servers. It is however modified if youPUT
orPOST
a file. If you want to modify it later, implementing something in the server like support for aPROPSET
tolastmodified
(mind the missing get) which does theutime()
call might be an option.For example the ownCloud WebDAV server does it that way.