WebDAV

Module: mod_webdav

Description

The WebDAV module is a very minimalistic implementation of RFC 2518. Minimalistic means that not all operations are implemented yet.

So far we have:

  • PROPFIND
  • OPTIONS
  • MKCOL
  • DELETE
  • PUT
  • LOCK (experimental)

and the usual GET, POST, HEAD from HTTP/1.1.

If you want to setup a WebDAV repository with authentication, make sure you are loading mod_webdav `before` mod_auth.

So far, mounting an open-access WebDAV resource into Windows XP (Network Places), Mac OS X (Finder) and Linux (Konqueror) works. Mounting an authenticated WebDAV resource works in Mac OS X and Linux. The basic litmus tests are passed.

Installation

mod_webdav is part of the 1.4.x distribution.

PUT, DELETE

If you are only looking for PUT and DELETE support, the basic mod_webdav works for you. No special compile-time options or libraries are required. PUT and DELETE are already part of the HTTP/1.1 spec, but are mostly used in combination with WebDAV.

PROPFIND, PROPPATCH

PROPFIND and PROPPATCH are used to do a directory-listing and to attach properties to a file-object.

As this involves parsing of XML-data we need libxml2. To make PROPPATCH work you need sqlite3 to store the properties in a separate location:

  • libxml2

    FC4:
    libxml2 libxml2-devel

  • sqlite3

    FC4:
    sqlite sqlite-devel

To compile mod_webdav with property-support you have to specify: ::

$ configure --with-webdav-props

LOCK, UNLOCK

LOCK and UNLOCK are necessary to get mounting of file-systems working. This involves generate unique lock-tokens. We use libuuid for this job.

  • libuuid

    FC4:
    e2fsprogs e2fsprogs-devel

LOCK with includes parsing XML again, so have to provide the dependencies of the previous section and libuuid: ::

$ ./configure --with-webdav-props --with-webdav-locks

Options

webdav.activate
If you load the webdav module, the WebDAV functionality has to be enabled for the directories you want to provide to the user.

Default: disable

webdav.is-readonly
Only allow reading methods (GET, PROPFIND, OPTIONS) on WebDAV resources.

Default: writable

webdav.sqlite-db-name
The full path to the file you would like to use as your db file. This is required for webdav props and locks.

Default: <empty>

Examples

To enable WebDAV for the /dav directory, you wrap your webdav options in a conditional. You have to use the regex like below as you want to match the directory /dav and everything below it, but not e.g. /davos. ::

  $HTTP["url"] =~ "^/dav($|/)" {
    webdav.activate = "enable" 
    webdav.is-readonly = "enable" 
    webdav.sqlite-db-name = "/var/run/lighttpd/lighttpd.webdav_lock.db" 
  }

If you would like LOCK support ::

  $HTTP["url"] =~ "^/dav($|/)" {
    webdav.activate = "enable" 
    webdav.is-readonly = "disable" 
    webdav.sqlite-db-name = "/var/run/lighttpd/lighttpd.webdav_lock.db" 
  }

note : The WebDAV directory should be a child of the document root. So if you want to add a server.document-root option to the /dav configuration, the path should be a child of the server.document-root (Otherwise move and copy function will not work correctly). (Take a look in mod_webdav.c line 1830)

litmus tests

We use http://webdav.org/neon/litmus/ (version 0.10.5) to verify that we support at least the basic of the WebDAV spec.

For now we are far away from 100%.

  • we don't handle If: ... headers
  • we handle shared locks as exclusive locks
  • the failing basic.8 is new in 1.4.13 as we stripped off the fragments for clean URLs

Handle the If: header requires a parser as it contains logical expressions. To give you an overview what works and what isn't: ::

  -> running 'basic':
   8. delete_fragment....... WARNING: DELETE removed collection resource with Request-URI including fragment; unsafe
      ...................... pass (with 1 warning)
  <- summary for `basic': of 15 tests run: 15 passed, 0 failed. 100.0%
  -> 1 warning was issued.
  -> running `copymove':
   4. copy_overwrite........ WARNING: COPY to existing resource didn't give 204
      ...................... pass (with 1 warning)
   8. move.................. WARNING: MOVE to existing collection resource didn't give 204
      ...................... pass (with 1 warning
  <- summary for `copymove': of 12 tests run: 12 passed, 0 failed. 100.0%
  -> 2 warnings were issued.
  -> running `props':
  <- summary for `props': of 26 tests run: 26 passed, 0 failed. 100.0%
  -> running `locks':
  16. fail_cond_put......... FAIL (conditional PUT with invalid lock-token should fail: 200 OK)
  18. cond_put_corrupt_token FAIL (conditional PUT with invalid lock-token should fail: 200 OK)
  20. fail_complex_cond_put. FAIL (PUT with complex bogus conditional should fail with 412: 200 OK)
  22. fail_cond_put_unlocked FAIL (conditional PUT with invalid lock-token should fail: 200 OK)
  27. double_sharedlock..... FAIL (shared LOCK on locked resource: 423 Locked)
  34. notowner_modify....... FAIL (DELETE of locked resource should fail)
  <- summary for `locks': of 39 tests run: 33 passed, 6 failed. 84.6%