Attention

You are looking at outdated documentation for version 2.x. A newer version is available.

wsgidav.request_resolver

Description

WSGI middleware that finds the registered mapped DAV-Provider, creates a new RequestServer instance, and dispatches the request.

Warning

The following documentation was taken over from PyFileServer and is outdated.

WsgiDAV file sharing

WsgiDAV allows the user to specify in wsgidav.conf a number of realms, and a number of users for each realm.

Realms

Each realm corresponds to a filestructure on disk to be stored, for example:

addShare('pubshare','/home/public/share')

would allow the users to access using WebDAV the directory/file structure at /home/public/share from the url http://<servername:port>/<approot>/pubshare

The realm name is set as ‘/pubshare’

e.g. /home/public/share/WsgiDAV/LICENSE becomes accessible as http://<servername:port>/<approot>/pubshare/WsgiDAV/LICENSE

Users

A number of username/password pairs can be set for each realm:

adduser('pubshare', 'username', 'password', 'description/unused')

would add a username/password pair to realm /pubshare.

Note: if developers wish to maintain a separate users database, you can write your own domain controller for the HTTPAuthenticator. See http_authenticator.py and domain_controller.py for more details.

Request Resolver

WSGI middleware for resolving Realm and Paths for the WsgiDAV application.

Usage:

from wsgidav.request_resolver import RequestResolver
WSGIApp = RequestResolver(InternalWSGIApp)

The RequestResolver resolves the requested URL to the following values placed in the environ dictionary. First it resolves the corresponding realm:

url: http://<servername:port>/<approot>/pubshare/WsgiDAV/LICENSE
environ['wsgidav.mappedrealm'] = /pubshare

Based on the configuration given, the resource abstraction layer for the realm is determined. if no configured abstraction layer is found, the default abstraction layer fileabstractionlayer.FilesystemAbstractionLayer() is used:

environ['wsgidav.resourceAL'] = fileabstractionlayer.MyOwnFilesystemAbstractionLayer()

The path identifiers for the requested url are then resolved using the resource abstraction layer:

environ['wsgidav.mappedpath'] = /home/public/share/WsgiDAV/LICENSE
environ['wsgidav.mappedURI'] = /pubshare/WsgiDAV/LICENSE

in this case, FilesystemAbstractionLayer resolves any relative paths to its canonical absolute path

The RequestResolver also resolves any value in the Destination request header, if present, to:

Destination: http://<servername:port>/<approot>/pubshare/WsgiDAV/LICENSE-dest
environ['wsgidav.destrealm'] = /pubshare
environ['wsgidav.destpath'] = /home/public/share/WsgiDAV/LICENSE-dest
environ['wsgidav.destURI'] = /pubshare/WsgiDAV/LICENSE
environ['wsgidav.destresourceAL'] = fileabstractionlayer.MyOwnFilesystemAbstractionLayer()

Classes

RequestResolver()

Other Members

BaseMiddleware(application, config) Abstract base middleware class.
DAVError(statusCode[, contextinfo, …]) General error class that is used to signal HTTP and WEBDAV errors.
HTTP_NOT_FOUND int(x=0) -> int or long int(x, base=10) -> int or long
RequestServer(davProvider)
util Miscellaneous support functions for WsgiDAV.