为什么 WebDAV 实现不支持获取文件夹

Why do WebDAV implementations not support GETing a folder

RFC 2518 规定:

The semantics of GET are unchanged when applied to a collection,
since GET is defined as, "retrieve whatever information (in the form
of an entity) is identified by the Request-URI" [RFC2068]. GET when
applied to a collection may return the contents of an "index.html"
resource, a human-readable view of the contents of the collection, or something else altogether. Hence it is possible that the result of a
GET on a collection will bear no correlation to the membership of the collection.

作为 owncloud 的用户,我经常发现自己在初始同步包含大量小文件的文件夹时性能低下(有关报告相同问题的其他人,请参阅 owncloud bugtracker)。经过一番调查后,我得出的结论是,罪魁祸首是底层的 WebDAV 实现,它为集合生成 index.html,从而迫使客户端对每个文件发出 GET 请求。由于每个 GET 都会导致显着的开销(大约数百毫秒),因此整个操作从不使用可用带宽并且被认为非常慢。

那么广泛使用的 WebDAV 实现不允许客户端一次下载整个文件夹的原因是什么?规范没有明确禁止。这肯定会提高性能,所以我想这个限制一定有一些技术原因。

The specification does not explicitly forbid it.

它没有禁止它,但它甚至没有暗示这是实现应该做的事情。给出的所有示例都是关于检索内容的 列表或索引 ,而不是内容本身。

此外,即使服务器实现选择支持检索集合的内容,也没有格式规范(如何将单个文件打包成一个下载)。所以这样的实现将是专有的,您的 WebDAV 客户端无论如何都不会支持它。