What is akaDAV

akaDAV is a Python module that adds WebDAV functionality to the Twisted 1.3. It makes WebDAV server application programming easy in Python.

Features

The current version has the following limitations. We are planning to support them in a future version:

Download

You can download the source code from SourceForge project page.

Installation

The following packages are required to run akaDAV:

Python (version 2.3 or newer)
http://python.org/
Twisted 1.3
http://twistedmatrix.com/products/download
PyXML
http://pyxml.sourceforge.net/

For those who need to process CJK texts, install one of the following Python codecs. (NOTE: This is only necessary for Python 2.3. CJK codecs are now the parts of the distribution in Python 2.4.)

JapaneseCodecs
http://www.python.jp/Zope/download/JapaneseCodecs
CJKCodecs
http://cjkpython.berlios.de/index-ja.html

Furthermore, when you need SSL support:

pyOpenSSL
http://pyopenssl.sourceforge.net/

After installing these packages, expand the akaDAV archive, chdir to it and type the following command:

python  setup.py install

Running a server application

Suppose we are starting akadavsvr.py, a WebDAV server application, with the following configurations:

First, add the user akadav and create a home directory, then create the following files and subdirectories that the server will use:

/home/akadav/htdocs/
the top Web contents directory, which is equal to DocumentRoot in Apache server. Accessible via http://hostname/.
/home/akadav/yasusii/
a WebDAV folder for user yasusii. Accessible via http://hostname/yasusii/
/home/akadav/murako/
a WebDAV folder for user murako. Accessible via http://hostname/murako/
/home/akadav/share/
a shared folder that both users can read and/or write. Accessible via http://hostname/share/
/home/akadav/users
a password file that is used for the HTTP Basic Authentication. This file is created by using akpasswd, a command compatible with Apache's htpasswd. When creating a new password file, use -c option for the first user.
akpasswd -c /home/akadav/users yasusii
Now create the second user without -c option.
akpasswd /home/akadav/users murako
/var/log/akadav/
a directory for logging. Allow only root to write this directory.
/var/run/
a directory for a lock (pid) file. In most systems such as Linux and FreeBSD, this directory should already exist in the system.

Then copy "akadavsrv.py", a server startup script, from the "application" directory in the archive to the home directory, /home/akadav and modify it with a text editor. Since the current version of akaDAV uses Python statements directly as settings, make sure there is no syntax error. In future, we will split these settings into a separate text file.

# Pathname to the access log.
SITE_ARGS.update({"logPath": "/var/log/akadav/access.log"})

# For clients which use a character encoding other than utf-8 for WebDAV
# requests, put a pattern to identify those clients in the dictionary.
# The key is a regexp pattern that matches to the UserAgent, and the value
# is the encoding name which the UserAgent will use.
# (In the following, the sample settings are commented out. Do not put
# an extra space when you are actually using them.)
SITE_ARGS.update({"agentEncodings": {
    r"Microsoft .* DAV 1\.1$": "cp932",
    r"xdwin9x/": "cp932"}})

# Server TCP port number.
PORT = 80

# User ID of the server process (UID for user akadav)
APP_ARGS.update({"uid": 503})
# Group ID of the server process (GID for user akadav)
APP_ARGS.update({"gid": 503})

# ocumentRoot (top directory for static HTML contents)
ROOT = "/home/akadav/htdocs"

# WebDAV folder configuration is given as a list of 4-element tuples.
# Each tuple consists of the following fields:
#
# Name:
#   The name that is used in a URL. If the name is "abc", the folder URL
#   becomes http://hostname/abc/.
# Pathname:
#   The directory pathname where actual WebDAV files are stored.
# Password file:
#   The pathname for a password file created with akpasswd command.
# List of users:
#   A list of user names that are allowed to access this folder. Each user
#   should be registered in the password file specified above.
#
CHILDREN = [
    # (name, pathname, password file, [list of users])
    ("yasusii", "/home/akadav/yasusii", "/home/akadav/users", ["yasusii"]),
    ("murako", "/home/akadav/murako", "/home/akadav/users", ["murako"]),
    ("share", "/home/akadav/share", "/home/akadav/users", ["yasusii", "murako"])
    ]

After modifying the file, run the folloing command to start the server:

twistd --logfile=/var/log/akadav/error.log \
       --pidfile=/var/run/akadav.pid \
       -oy /home/akadav/akadavsvr.py

The URL for a WebDAV client to connect a user folder, say yasusii, is http://hostname/yasusii/. If something went wrong, check the error log file at /var/log/akadav/error.log.

To stop the server, use kill command.

kill `cat /var/run/akadav.pid` 

Changes

Vresion 0.6.2
  • Add Apache's htpasswd compatible command.
  • Add Basic Authentication feature.
  • Add sample server application.
Version 0.6.1
  • Add some english document.
Version 0.6
  • First public release.

License

Current version of akaDAV is is published under the terms of the LGPL (GNU Lesser General Public License). But future version will be released under MIT license.