Barracuda Application Server C/C++ Reference
WebDAV Struct Reference

Detailed Description

The WebDAV plugin implements WebDAV version 1, as specified in RFC2518 and part of the locking in DAV 2, making it interoperate with "drive" clients requiring locking.

The purpose of the WebDAV plugin is to make it possible to use the server as a remote disk. The locking in DAV 2 is partly implemented in order to make it interoperate with "drive" clients requiring locking. A "drive" client such as davfs2 can then be mounted as a drive.

For some unknown reason, some "drive" clients, such as Mac OS X, require locking. The WebDAV plugin needs to store the locking information in files on the file system. The "lockDir" argument in the constructor must point to an existing directory or to an existing parent directory. The WebDAV plugin attempts to create this directory if it does not exist and marks it as hidden for file systems supporting hidden files.

Not all clients require locking. For example, Web Folders work without locking. You can set the "lockDir" argument to NULL if you do not want to support the simple locking implemented in the WebDAV plugin. As an example, Mac OS X will mount the drive as read only.

The simple locking implemented in the WebDAV plugin also requires a dynamic object per active lock. The maxNumberOfLocks constructor argument controls how many concurrent locks the server allows. For example, this can be set to 2-4 for a standard embedded system.

The WebDAV plugin creates a subdirectory ".DAV" if a client sends a "set <a href=""> dead property</a> request". This sub directory contains XML files for storing the dead properties. The .DAV directory is only created if the client creates dead properties. The .DAV directory will be marked as hidden for file systems supporting hidden files.

See also

#include <WebDAV.h>

Inheritance diagram for WebDAV:

Public Member Functions

 WebDAV (IoIntf *io, int maxUploads, const char *dirName, const char *lockDir, U32 maxNumberOfLocks=10, AllocatorIntf *alloc=0, S8 priority=0)
 Create a WebDAV instance. More...
 ~WebDAV ()
 Terminate the WebDAV object. More...
- Public Member Functions inherited from HttpDir
 HttpDir ()
 Constructor for creating a root dir, a root dir has no name.
 HttpDir (const char *name, S8 priority=0)
 Constructor for creating a sub-directory. More...
int insertDir (HttpDir *dir)
 Insert a sub-directory. More...
int insertPage (HttpPage *page)
 Insert a page in the directory. More...
HttpPagegetFirstPage ()
 Returns the first page.
HttpDirgetFirstDir ()
 Returns the first sub-directory.
HttpDirgetDir (const char *name)
 Returns the first directory with the name given or NULL if not found.
HttpPagegetPage (const char *name)
 Returns the page with the name given or NULL if not found.
HttpDirgetNext ()
 Returns the next dir in the parent list. More...
HttpPagefindPage (HttpPage *iter, const char *name)
 Searches for a page in this directory node. More...
HttpDircreateOrGet (const char *name)
 Returns a sub-directory with the given name. More...
const char * getName () const
 Returns the directory name.
HttpDirgetParent () const
 Returns the parent directory or NULL if no parent.
char * makeAbsPath (const char *relPath, int relPathLen)
 Makes an absolute path based on where the HttpDir instance is installed in the virtual file system and the provided relative path. More...
char * getRootPath ()
 Calculates the root of where the HttpDir instance is installed in the virtual file system. More...
HttpDir_Service overloadService (HttpDir_Service s)
 Replace the original service function in HttpDir with your own. More...
void p403 (const char *p403)
 Set a 403 denied request handler. More...
bool isLinked ()
 Returns true if this directory node is installed into a parent directory.
int unlink ()
 Unlinks/removes the directory from the parent directory.
void setAuthenticator (struct AuthenticatorIntf *authenticator, struct AuthorizerIntf *authorizer=0)
 Set the optional authenticator and/or the optional AuthorizerIntf. More...
bool authenticateAndAuthorize (HttpCommand *cmd, const char *path)
 Authenticate and authorize the user. More...

Additional Inherited Members

- Static Public Member Functions inherited from HttpDir
static HttpDirfindDir (HttpDir *iter, const char *name, unsigned int nameLen)
 Searches for a sub-directory in this directory node. More...

Constructor & Destructor Documentation

◆ WebDAV()

WebDAV::WebDAV ( IoIntf io,
int  maxUploads,
const char *  dirName,
const char *  lockDir,
U32  maxNumberOfLocks = 10,
AllocatorIntf alloc = 0,
S8  priority = 0 

Create a WebDAV instance.

You can create several instances of this class and install several instances into the virtual file system.

iois a IoIntf implementation such as DiskIo. The WebDAV plugin can also work with "read only" IoIntf implementations such as the ZipIo. The WebDAV plugin allows method OPTIONS, HEAD, GET, and PROPFIND for a "read only" IoIntf implementation.
maxUploadsis the limit value for concurrent asynchronous uploads. Downloads are also using asynchronous sockets, but it is not possible to set a limit on the number of downloads.
dirNameis the HttpDir name.
lockDiris the name of the lock directory. See explanation above.
maxNumberOfLocksis the maximum number of WebDAV locks. See explanation above for max number of locks.
allocis the allocator used for all internal memory allocations and re-allocations. The WebDAV plugin relies on heavy use of dynamic memory.
priorityis the HttpDir priority.

◆ ~WebDAV()

WebDAV::~WebDAV ( )

Terminate the WebDAV object.

Please note that any upload in progress will be aborted.