WebDAV for TclHttpd

This is a simple WebDAV-extension to let TclHttpd work as a WebDAV-server.

News

  • August 04 – WebDAV for TclHttpd is program of the week (POTW) (see [1]). Thanks a lot!
  • July 04 – Released version 0.1a

Introduction

This is a simple WebDAV-extension which could be used in conjunction with the TclHttpd-Webserver to built a WebDAV-Server.

You have embedded TclHttpd in your application to provide web-access? Why not additionally add WebDAV-support as well?

Because of this being considered as a prototype you should be warned (this is alpha-status).

Features

  • WebDAV-Support for files in the webserver-docroot
  • WebDAV-Support for vfs-mountable files (such as starkit-, zip- or tar-files)
  • Quite easy to extend
  • Is tested with:

So what is that? With the provided tcl-files (see Download) you put into your custom-directory you can turn your TclHttpd-Webserver into a WebDAV-Server. You can e.g. expose vfs-files to be accessed via WebDAV. Suppose you have a zip-file. Put that in your docroot and you can browse through the zip-file with a WebDAV-Client (like Internet Explorer or Konquerer).

Maybe you have some starkits, simply connect a Web folder with your WebDAV-server and browser through the contents of the starkit (see image below).

Though this implementation is quite useful you should be aware of several

Drawbacks

  • No support for locking
  • No support for authentification
  • No support for versioning (so it’s kind of WebDA ;-)
  • No threading-support (at least: I haven’t tested it)
  • Testing is very incomplete (COPY of collections??)
  • depth-header is mostly ignored
  • many empty spaces in the implementation

Keep in mind, that this was just a fun-project for me and no serious WebDAV-implementation. One more drawback is the mapping of path-prefixes to the Url-Prefix-Handler. Maybe I will change that later.

Preconditions

WebDAV for TclHttpd needs the following modules:

If you get the latest Tcl-Distribution everything should be in place (besides TclHttpd).

Installation

To make your TclHttpd WebDAV-aware simply follow these steps:

  • Download webdav_01a.zip
  • Extract the zip-file into the ‘custom’-directory of your TclHttpd-installation
  • Create a directory in the ‘htdocs’-directory that should provide WebDAV-access (e.g. dav)
  • put some files in that directory
  • Create another directory (let’s say kit) in which you may place starkit-, zip- or tar-files (be sure to use the extensions .kit, .tar or .zip resp. in all other cases the files will not be recognized (see webdav_vfs.tcl).
  • Adapt webdav.conf to your needs (if you follow this example and use the given directory-names, everything should work with the provided webdav.conf

That’s it.

Now you can use your Internet Explorer and create/open a Web folder with this Url:

 http://your-server:your-port/kit/  (or /dav/)

If you have a standard installation of TclHttpd use: http://localhost:8015/dav/

Remember to check “Open as webfolder”.
Depending on the content in that directory you could see something like this:

webdav

Screenshot of WebDAV, seen from Windows Explorer

This image shows a mapped Web folder in the usual Windows-Explorer. Currently I just browsed inside the
file-structure of patience.kit (an implementation of the patience-card-game which I just had lying around, you can download the starkit from [2]).

Configuration

To configure WebDAV have a look at webdav.conf. The content is explained a little bit more detailled in the next chapter.

Extend WebDAV

Maybe you even want to extend WebDAV for other purposes. Simply create a file like webdav_mymodule.tcl inside the TclHttpd-custom-directory. Add the following lines to webdav.conf.

webdav_resource ''/your-path'' {
  filename custom/webdav_mymodule.tcl
  namespace my::webdav::module
}

When TclHttpd starts it reads the custom-directory-files. Sourcing webdav.tcl results in evaluating webdav.conf. All resources listed there would be read in as well.
The function webdav_resource takes 2 parameters. The first one is the absolute path in your htdocs (this is used to install the handler with Url_PrefixInstall) The second parameter contains a list of key-value-pairs. filename and namespace must be given to let webdav automatically source in the files and call the corresponding functions. More key-value-pairs can be entered and could be used by your own module.

Your module has to support a few functions (to get a working WebDAV-functionality). These are:

  • your_namespace::GET
  • your_namespace::PROPFIND

Furthermore you can implement all functions which are needed by WebDAV according to rfc2518.

Download

Examples

You want to give it a try but don’t have a WebDAV-client? Why not use webdav_vfs from tclvfs?

Assume you have put a starkit.kit inside htdocs/kit. Open a tcl-shell and then mount the resource (in this example an url to the webdav_vfs-handler):

package require vfs
vfs::webdav::Mount http://localhost:8015/kit/ kit
cd kit
glob *  ;# yields a list of file-names in the kit-directory

# assume you have a starkit there (e.g. patience.kit, see image above)
cd patience.kit
# you're now inside the starkit-file
glob *  ;# return a list of files/directories inside the starkit

You can do so with zip- or tar-files as well. Isn’t that crazy? You access
zip-files via WebDAV. I’m quite astonished about this :-) and I’m having a lot of fun with it.

Be warned. The webdav-client implementation needs at least as much work as this webdav-server implementation :-)

History

29. Jul. 2004

Released version 0.1a (damn IE is such a nit-pick DAV-client). Removed property lastaccessed!

28. Jul. 2004

Released initial version (0.1)

References

Copyright/License

This software is copyright © 2004-2010 by Stefan Vogel.

This software is released under GPL.

Teilen oder mailen:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • MisterWong.DE
  • StumbleUpon
  • Technorati
  • Twitter
  • Wikio
  • Yigg
  • email
  • PDF

2 Antworten to “WebDAV for TclHttpd”

  1. zoranarchiwarecom sagt:

    Feine Arbeit! Ich werde es mir mal angucken. Wenn Zeit erlaubt, schaue ich
    dass ich es evtl. fuer AOLserver anpasse.

    Gruesse, Zoran

  2. Stefan sagt:

    Im Zuge der Migration auf Wordpress habe ich alle “kastrierten” SPAM-Kommentare gelöscht. Eigentlich schade, denn es waren so aussagekräftige dabei wie:
    Good site!!! I found your site in the google. (sehr geistreich)
    Sentimental and nostalgic. Great. (wie bitte?)
    I wanted to thank you for the time you spent building this page (na, das passt immer)
    I you all love! (Hallo?)

Eine Antwort hinterlassen

(erforderlich)

(erforderlich)