Open RomainTT opened 1 month ago
The WebDAV RFC was published June 2007 (which is 17 years ago) https://www.rfc-editor.org/rfc/rfc4918#section-9.1
A client MUST submit a Depth header with a value of "0", "1", or "infinity" with a PROPFIND request. Servers MUST support "0" and "1" depth requests on WebDAV-compliant resources and SHOULD support "infinity" requests. In practice, support for infinite-depth requests MAY be disabled, due to the performance and security concerns associated with this behavior. Servers SHOULD treat a request without a Depth header as if a "Depth: infinity" header was included.
get_props()
should most definitely be updated to send an appropriate Depth
header.
Note: not all servers support Depth: infinity
.
lighttpd supports Depth: infinity
, but disables PROPFIND Depth: infinity
by default, unless explicitly configured in lighttpd.conf: webdav.opts += ("propfind-depth-infinity" => "enable")
Therefore, if you send Depth: infinity
, you should be prepared to fall back to multiple PROPFIND requests with Depth: 1
Observations
When using lighttpd webdav module as a webdav server. When using get_props on a resource (directory or file). The following exception is raised:
This is because propfind returns an empty content (the XML is valid, but with no data).
Solution
After several tests I found out that
propfind
works well if the correctDepth
header.Depth: 1
as used by ls is listing files correctly.Depth: 0
allows to get properties of a single filepath. Example below:As
get_props
is meant to read properties of a single filepath, it seems relevant to addDepth: 0
to the headers in this method.Here is a fix which is working for me:
But I am not sure of the all the consequences, maybe I’m missing the big picture. I did not test this with another webdav server like Nextcloud.
What do you think?