DocumentsPersonal
WebDAV Protocol Compliance
WebDAV Protocol Compliance
Type
Topic
Status
Published
Created
Jul 7, 2026
Updated
Jul 7, 2026
Created by
Dosu Bot
Updated by
Dosu Bot

WebDAV Protocol Compliance#

Overview#

The OpenDAL WebDAV integration (integrations/dav-server) implements the DavFileSystem trait from the dav-server crate via the OpendalFs struct, bridging any OpenDAL Operator backend to a standards-compliant WebDAV file system. Protocol compliance logic is concentrated in two files: fs.rs (request handling) and dir.rs (directory listing).


RFC 2518 MKCOL Compliance#

create_dir in fs.rs implements the two mandatory MKCOL constraints from RFC 2518 §8.3.1:

1. Parent Must Exist#

Before creating a directory, the implementation checks that the parent collection exists . The comment directly references the spec:

"During MKCOL processing, a server MUST make the Request-URI a member of its parent collection, unless the Request-URI is '/'. If no such ancestor exists, the method MUST fail."

The parent path is derived using Path::new(&path).parent(), then tested with op.exists(format!("{}/", parent.display())). If the parent does not exist (and is not the root /), the method returns FsError::NotFound .

2. Collection Must Not Already Exist#

After the parent check, the target path is checked for prior existence . If a resource already exists at that path, the method returns FsError::Exists — mapping to the 405 Method Not Allowed response mandated by RFC 2518 for MKCOL on an existing collection .


Path Normalization#

In Directory Listing#

OpendalStream::new normalizes the directory path with opendal::raw::normalize_path immediately on construction . The stream also skips the directory's own entry (where entry.path() == dav_stream.path) to avoid returning the directory itself when listing its contents.

normalize_path Internals#

The canonical implementation lives in core/src/raw/path.rs. Its normalization rules:

  • Trims all surrounding whitespace
  • Strips all leading / characters
  • Collapses internal // sequences to /
  • Returns / for empty paths
  • Preserves trailing / to distinguish directory vs. file paths

Note: The whitespace-trimming behavior documented in the source is the current snapshot. PR #7451 proposed removing the .trim() call to preserve intentional spaces in filenames (e.g., "file " being incorrectly normalized to "file"). If your version of OpenDAL includes that fix, whitespace is preserved and only leading / is stripped.

Path Extraction in OpendalFs#

The fs_path helper converts a DavPath to a UTF-8 String. Path normalization at the dav-server layer is handled by DavPath itself before this conversion; normalize_path is applied in the streaming layer after the OpenDAL lister is created.


Other DavFileSystem Operations#

MethodImplementation
read_dirCalls op.lister, wraps result in OpendalStream
metadataCalls op.stat, wraps in OpendalMetaData
remove_dirDelegates to remove_file
renameUses op.rename; pre-removes destination for collections
copyUses op.copy via relative paths

Key Source Files#

FilePurpose
integrations/dav-server/src/fs.rsMain DavFileSystem impl, MKCOL compliance
integrations/dav-server/src/dir.rsDirectory listing stream, path normalization
core/src/raw/path.rsnormalize_path and normalize_root definitions