集合中的 getcontentlength 属性 是否有定义的含义?

Is there a defined meaning to the getcontentlength property on a collection?

下面的响应片段是 PROPFIND 回复的一部分:

<D:response>
<D:href>https://dav.mystery-meat.com/top</D:href>
<D:propstat>
<D:prop>
<D:creationdate ns0:dt="dateTime.tz">1970-01-01T00:00:00Z</D:creationdate>
<D:getcontentlanguage>en</D:getcontentlanguage>
<D:getcontentlength>16384</D:getcontentlength>
<D:getcontenttype>httpd/unix-directory</D:getcontenttype>
<D:getlastmodified ns0:dt="dateTime.rfc1123">Thu, 01 Jan 1970 00:00:00 GMT</D:getlastmodified>
<D:resourcetype><D:collection/></D:resourcetype>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>

getcontentlength 值不是此目录中项目的总字节数。 WebDAV 中此值是否有任何预定义的含义,或者它只是由碰巧报告值的每个服务器的实现者定义?

即有实际用处吗?

阅读the RFC,像往常一样它有一个完美的定义:

Purpose: Contains the Content-Length header returned by a GET without accept headers.

如果不清楚,它基本上是说,如果您在没有 Accept-* headers 的同一资源上执行 GET 请求,响应将报告 Content-Length就是这个值。

因此,如果您有一个符合标准的 WebDAV 实现,您应该能够通过在 collection 上执行 GET 请求来轻松测试它。您可能会收到一些自动生成的 HTML 响应。

如果此 GET 请求的响应大小(以字节为单位)与通过 {DAV:}getcontentlength 报告的不同,则应将其视为错误。

我认为在您的特定情况下,这可能是一个错误。 collection 的报告大小恰好是 2 的幂,这一事实让我相信这个特定的服务器 returns 是该目录的 stat() 的结果,这就是多少space 目录列表占用文件系统(与使用 ls 时的数量相同)。

如果我的预感是正确的,那么服务器基本上出现故障了。