Logo address



WebDAV script

Lua WebDAV script

WebDAV script for Pegasus is in http://plan9.aichi-u.ac.jp/netlib/lua/.
The name is "webdav" which is written in 9lua. (Lua with plan9 extension)

The WebDAV works for Mac/OSX, WinXP and optionally for Win2000. I have not examined other type of clients yet.
Win2000 client requires dirty codes in Pegasus. Therefore Win2000 support is only enabled by a compilation option

Pegasus that compiled under this option will lose some of simple logical structure stated in this document.

You can use Digest authentication. Of course, you may not use authentication for debugging purpose.

My old WebDAV script was written in Perl. In releasing Pegasus 2.6, I have rewritten the script in Lua, because we have big advantages if we switch the scripting language from Perl to Lua:



Look http://plan9.aichi-u.ac.jp/netlib/webappls/webdav_lua/
You will find there:

9lua-5.2 is plan9 extension of Lua-5.2.


webdav log

The following line in /usr/web/bin/rc/webdav controls webdav log.

-- LOG = io.open("/log/webdav.log","a")	-- uncomment if you need log
If you want remove "--" at the beginning of the line.

The log is located at $web/log. ($web is your httpd root)

NB: /log/webdav.log may grow to huge size. So it is wise to comment out unless you need debugging.


In the explanation below, $web is a httpd root of a user, and host stands for "host", "host:port" or "host/~user".


/dav		-	*	/bin/webdav	/doc
/dav/*		-	*	/bin/webdav	/doc

NOTE: handler interface is simplefied in webdav 1.3
The old one was
/dav		-	*	/bin/webdav	/dav /doc
/dav/*		-	*	/bin/webdav	/dav /doc

Then your files in document space can be mounted as remote file system with URL:


You may replace "/dav" by other "/bar" and likewise you may replace "/doc" by "/path/foo". Thus you may have WebDAV storage out of document root.


Protect your WebDAV by password. My example is
arisawa	1ecdd023fbd3c3fe8f63b05827c0d38a	/dav arisawa@hera
where arisawa@hera is my realm and the md5 value is obtained by
	echo -n 'arisawa:arisawa@hera:black cat' | md5sum
for password "black cat".

Permission Setting

You need to make all files and directories in your document space readable/writable (and also executable for directories) for user web.

I recommend you to use WebDAV only in your home network. The reason is
(1) security
(2) net work band width

Tested clients

I am afraid that my testing is not enough.
Please email to me if you found bugs.


OSX 10.8/10.9

OSX client of old version was slow because of incredibly stupid behavior of the client.
Now Apple has fixed this problem. Current WebDAV on Mac is acceptable level.

OSX 10.5

OSX client is slow because of incredibly stupid behavior of the client.
There are many issues on this subject in the Internet.

OSX client does not make use of informations returned from PROPFIND request with Depth:1 except names in the collection. After the request, the client continues PROPFIND requests to all names in the collection although the client already has received requesting information. Thus, if a collection has 100 files then 100 PROPFIND requests continue in a short time.

OSX 10.4 should work as has been.


I haven't tried webDAV on Win7 and Win8 yet.


You need compilation option: -DWIN2000DAV


Due to a bug of WinXP, you need a trick in creating web folder: a mark "?" at the end of URI. The example is shown below.


The explanation below is for WinVista.

You need "Software Update for Web Folders (KB907306)" so that Vista WebDAV client gets to work.
Microsoft gave up to support WebDAV as a file system in Vista. The design is degraded from that of WinXP.
However some things are improved:
(1) you need not "?" magic such as

in creating "Network Place".
If you put "?" then Vista fails in creating Network Place.

(2) you need not host name "@host" such as

in your user name.