WebDAV Example

The WebDAV plugin is built into the FuguHub consumer product.

WebDAV is a set of extensions to the HTTP(S) protocol that enables a server to appear as a standard network drive.

WebDAV clients are native to Windows XP, Mac OS X, Linux, etc.. It is possible to mount a drive from one of these operating systems to one or several remote computers.

The following tutorial shows how one can mount a Windows drive to the WebDAV server. The online FuguHub documentation shows how to mount other operating systems. Please note that you can also run the server in an embedded device and mount a Windows computer to the device running Barracuda.

Compile and run the example. The WebDAV drive is accessible at URI '/dav/'.

Carefully read the following if you use Windows and use the same computer for the server and the client. Do not mount the root of the '/dav/' drive, or you will get a circular dependency between the client and server which will deadlock Windows and force you to reboot.

Open a DOS window and type in one of the commands below. The 'r' drive will be mounted as a network drive, and this enables you to use the drive as you would use the 'c' drive on your computer.

  1. Server compiled with VC++: net use r: http://localhost/dav/c/
  2. Server compiled with cygwin: net use r: http://localhost/dav/cygdrive/c/
  3. Running the client on another computer: net use r:

The IP address must be substituted with the IP address of the PC/device running Barracuda in example 3 above.

The above root mounting limitation only applies to a client that is incorporating WebDAV into the file system. The reason this deadlocks Windows is that the client tries to list all the root files at '/dav/'. This will basically be a list of all the drives in Windows, including the mounted drive 'r'. The server tries to access 'r', which leads to a deadlock.

The WebDAV home page lists a number of clients that are non 'file system drive' clients. You can use any of these clients if you would like to list the content of the root at '/dav/' when the client and server are on the same computer.

Exercise: Adding Authentication and Authorization

We suggest that you add authentication and authorization to the WebDAV example.


You can use one of the Basic or Digest authenticators, but a problem with many WebDAV clients is that some of them can only do Basic, whilst other clients require digest. We have, for this reason, made an authenticator class that lets the client know that it can authenticate using either Basic or Digest. The client selects the method it wants to use. The authenticator, called DavAuth, also handles the domain name prefix added to the user name by Microsoft WebDAV clients. See WebDAV::setAuthenticator for more information.


We suggest that you first add authentication and set the SecurityRealm to NULL.

Example: webDav->setAuthenticator(NULL, davAuth);