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 user_name/password pairs can be set for each realm:
adduser('pubshare', 'user_name', 'password', 'description/unused')
would add a user_name/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::
It must be configured as the last item on middleware_stack list.
from wsgidav.request_resolver import RequestResolver config = {
…, ‘middleware_stack’: [
…, RequestResolver,
],
}
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
|
Other Members
|
int([x]) -> integer int(x, base=10) -> integer |